Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GROUP_CONCAT(DISTINCT if(basedatos_postmeta.meta_key = "_billing_first_name", meta_value, NULL)) AS nombre,
- INNER JOIN basedatos_posts ON basedatos_postmeta.post_id = basedatos_posts.ID
- INNER JOIN basedatos_woocommerce_order_items ON basedatos_woocommerce_order_items.order_id = basedatos_posts.ID
- WHERE basedatos_woocommerce_order_items.order_item_name LIKE "%MIPRODUCTO%"
- AND basedatos_posts.post_type="shop_order" AND basedatos_posts.post_status="wc-completed"
- $result = mysqli_query($link, 'SELECT basedatos_postmeta.post_id, basedatos_posts.post_date AS fecha,
- GROUP_CONCAT(DISTINCT if(basedatos_postmeta.meta_key = "_billing_first_name", meta_value, NULL)) AS nombre,
- GROUP_CONCAT(DISTINCT if(basedatos_postmeta.meta_key = "_billing_last_name", meta_value, NULL)) AS apellidos,
- GROUP_CONCAT(DISTINCT if(basedatos_postmeta.meta_key = "_billing_state", meta_value, NULL)) AS provincia,
- GROUP_CONCAT(DISTINCT if(basedatos_postmeta.meta_key = "_billing_country", meta_value, NULL)) AS pais,
- GROUP_CONCAT(DISTINCT if(basedatos_woocommerce_order_items.order_item_type = "coupon", order_item_name, NULL)) AS cupon,
- basedatos_woocommerce_order_items.order_item_name AS navegacion
- FROM basedatos_postmeta
- INNER JOIN basedatos_posts ON basedatos_postmeta.post_id = basedatos_posts.ID
- INNER JOIN basedatos_woocommerce_order_items ON basedatos_woocommerce_order_items.order_id = basedatos_posts.ID
- WHERE basedatos_woocommerce_order_items.order_item_name LIKE "%MIPRODUCTO-X%"
- AND basedatos_posts.post_type="shop_order" AND basedatos_posts.post_status="wc-completed"
- AND (basedatos_postmeta.meta_key="_billing_first_name" OR basedatos_postmeta.meta_key="_billing_last_name" OR basedatos_postmeta.meta_key="_billing_state" OR basedatos_postmeta.meta_key="_billing_country")
- GROUP BY basedatos_posts.ID ORDER BY fecha ASC')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement