Reputation: 575
This query doesn't work but I hope it will suffice to make you understand what I need:
SELECT p.ID, lat.l
FROM hlp_posts AS p
WHERE p.ID
IN (SELECT pm.post_id, pm.meta_value AS l FROM hlp_postmeta AS pm WHERE pm.meta_key = "hlp_latitude") lat
What I need is getting in the main SELECT a value (lat.l
) selected in the subquery.
I can get it through a JOIN but I can't use it.
Upvotes: 1
Views: 56
Reputation: 30849
You can use JOIN
instead, e.g.:
SELECT p.id, pm.meta_value
FROM hlp_posts AS p JOIN hlp_postmeta pm ON p.ID = pm.post_id
WHERE pm.meta_key = "hlp_latitude";
Upvotes: 2