How can I combine one field using wpdb and group by?

Got it working with $uvusql = $wpdb->prepare( ” SELECT p.ID, p.post_title, p.post_date, wcom.order_item_name, wcomm.meta_key, wcomm.meta_value, wcomm2.meta_key AS meta_key_qty, wcomm2.meta_value AS meta_value_qty, pm2.meta_value AS meta_value_location FROM $wpdb->posts AS p INNER JOIN $wpdb->postmeta AS pm ON p.ID = pm.post_id INNER JOIN $wpdb->woocommerce_order_items AS wcom ON p.ID = wcom.order_id INNER JOIN $wpdb->woocommerce_order_itemmeta AS wcomm ON wcom.order_item_id = wcomm.order_item_id … Read more

UPDATE on SELECT results. A SQL query to swap Author with Meta Box value

I always find it way less confusing to get the results from one table and loop them rather than to try to join them like that… eg. global $wpdb; $query = “SELECT post_id FROM wp_postmeta WHERE meta_key=’fake_author’ AND meta_value=”11111″”; $results = $wpdb->get_results($query); foreach ($results as $result) { $query = “UPDATE wp_posts SET post_author=”222222″ WHERE ID='”.$result->post_id.”‘”; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)