a guest Feb 22nd, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT o.ID, fn.meta_value as first_name, ln.meta_value as last_name,
  2. SUBSTRING_INDEX(SUBSTRING_INDEX(t.meta_value,';',9),':',-1) AS tracking
  3. FROM `wp_posts` o
  4. JOIN `wp_postmeta` t ON t.post_id = o.ID
  5. JOIN `wp_postmeta` fn ON fn.post_id = o.ID
  6. JOIN `wp_postmeta` ln ON ln.post_id = o.ID
  7. WHERE
  8. o.`post_type` = 'shop_order'
  9. AND
  10. t.`meta_key` = '_wc_shipment_tracking_items'
  11. AND
  12. fn.`meta_key` = '_shipping_first_name'
  13. AND
  14. ln.`meta_key` = '_shipping_last_name';
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand