Query Return a list of product categories and orders …
-
Hi!
Have this query, that display order information from woocommerce
select p.ID as order_id, p.post_date, max( CASE WHEN pm.meta_key = '_billing_email' and p.ID = pm.post_id THEN pm.meta_value END ) as billing_email, max( CASE WHEN pm.meta_key = '_billing_phone' and p.ID = pm.post_id THEN pm.meta_value END ) as billing_phone, max( CASE WHEN pm.meta_key = '_billing_first_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_first_name, max( CASE WHEN pm.meta_key = '_billing_last_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_last_name, max( CASE WHEN pm.meta_key = '_order_total' and p.ID = pm.post_id THEN pm.meta_value END ) as order_total, max( CASE WHEN pm.meta_key = '_order_tax' and p.ID = pm.post_id THEN pm.meta_value END ) as order_tax, max( CASE WHEN pm.meta_key = '_paid_date' and p.ID = pm.post_id THEN pm.meta_value END ) as paid_date, ( select group_concat( order_item_name separator '|' ) from wpe9_woocommerce_order_items where order_id = p.ID and wpe9_woocommerce_order_items.order_item_type='line_item') as order_items from {$wpdb->prefix}posts as p join {$wpdb->prefix}postmeta as pm join {$wpdb->prefix}term_relationships as wptr where post_type = 'shop_order' and p.ID = pm.post_id and post_date BETWEEN '2015-01-01' AND '2017-12-31' group by p.post_date descBut need to get all categories for products in the order using
( select group_concat……So it give me the list of categories in a string…
How can i do this ?
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
The topic ‘Query Return a list of product categories and orders …’ is closed to new replies.