Advertisement
5ally

Untitled

Mar 13th, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.49 KB | None | 0 0
  1. SELECT P.post_title, P.post_content, P.post_author,
  2.   PM1.meta_value AS lat,
  3.   PM2.meta_value AS lng
  4. FROM wp_posts AS P
  5.   LEFT JOIN wp_postmeta AS PM1 ON ( P.ID = PM1.post_id AND PM1.meta_key = 'ex_latitude' )
  6.   LEFT JOIN wp_postmeta AS PM2 ON ( P.ID = PM2.post_id AND PM2.meta_key = 'ex_longitude' )
  7. WHERE 1=1
  8.   AND (
  9.     PM1.meta_key = 'ex_latitude' OR
  10.     PM2.meta_key = 'ex_longitude'
  11.   )
  12.   AND P.post_type = 'post'
  13.   AND P.post_status = 'publish'
  14. GROUP BY P.ID
  15. ORDER BY P.ID DESC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement