Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. GROUP_CONCAT(DISTINCT if(basedatos_postmeta.meta_key = "_billing_first_name", meta_value, NULL)) AS nombre,
  2.  
  3. INNER JOIN basedatos_posts ON basedatos_postmeta.post_id = basedatos_posts.ID
  4. INNER JOIN basedatos_woocommerce_order_items ON basedatos_woocommerce_order_items.order_id = basedatos_posts.ID
  5. WHERE basedatos_woocommerce_order_items.order_item_name LIKE "%MIPRODUCTO%"
  6. AND basedatos_posts.post_type="shop_order" AND basedatos_posts.post_status="wc-completed"
  7.  
  8. $result = mysqli_query($link, 'SELECT basedatos_postmeta.post_id, basedatos_posts.post_date AS fecha,
  9. GROUP_CONCAT(DISTINCT if(basedatos_postmeta.meta_key = "_billing_first_name", meta_value, NULL)) AS nombre,
  10. GROUP_CONCAT(DISTINCT if(basedatos_postmeta.meta_key = "_billing_last_name", meta_value, NULL)) AS apellidos,
  11. GROUP_CONCAT(DISTINCT if(basedatos_postmeta.meta_key = "_billing_state", meta_value, NULL)) AS provincia,
  12. GROUP_CONCAT(DISTINCT if(basedatos_postmeta.meta_key = "_billing_country", meta_value, NULL)) AS pais,
  13. GROUP_CONCAT(DISTINCT if(basedatos_woocommerce_order_items.order_item_type = "coupon", order_item_name, NULL)) AS cupon,
  14. basedatos_woocommerce_order_items.order_item_name AS navegacion
  15. FROM basedatos_postmeta
  16. INNER JOIN basedatos_posts ON basedatos_postmeta.post_id = basedatos_posts.ID
  17. INNER JOIN basedatos_woocommerce_order_items ON basedatos_woocommerce_order_items.order_id = basedatos_posts.ID
  18. WHERE basedatos_woocommerce_order_items.order_item_name LIKE "%MIPRODUCTO-X%"
  19. AND basedatos_posts.post_type="shop_order" AND basedatos_posts.post_status="wc-completed"
  20. 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")
  21. GROUP BY basedatos_posts.ID ORDER BY fecha ASC')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement