Thanks. I forgot you can join a table on more than one condition.
I also forgot to mention that there will be duplicate entries per location, as multiple Wordpress posts might be linked to a single location (thanks to WP's crappy DB design). The reason for the subquery was so I could limit results to a single row.
I modified your suggested code, which is working much better. The WHERE clause is working now, but for some reason, even though I'm limiting the subquery results to a single post_id, I'm still getting multiple rows returned. I've confirmed my data isn't corrupted. The post_id/latitude and post_id/longitude combos are unique records.
Code:
SELECT lat.meta_value AS lt, lng.meta_value AS lg, post.post_id FROM wp_postmeta AS post
LEFT OUTER JOIN wp_postmeta AS lat ON lat.post_id = post.post_id AND lat.meta_key = '_jr_geo_latitude'
LEFT OUTER JOIN wp_postmeta AS lng ON lng.post_id = post.post_id AND lng.meta_key = '_jr_geo_longitude'
WHERE post.post_id = (SELECT post_id FROM wp_postmeta WHERE meta_value = 'some_location' LIMIT 1)
Bookmarks