SELECT meta_value
FROM wp_postmeta
WHERE meta_key = "bid_resource_lat"
AND meta_key = "bid_resource_lng"
I’m trying to select two rows within one query, as you can see above … and I can’t wrap my head around why this isn’t working…
And how would I make sure that the two results are grouped together within a row?
You need “OR” as the logic is the wrong way round from as you’re imagining it.
Explanation:
You want to get a row if the key is either the first OR if it’s the second. This returns up to two rows. The way you wrote it then both conditions needed to be matched.
“I want a car that is italian OR expensive” – You can get a Ferrari, a Mercedes and a Fiat
“I want a car that is italian AND expensive” – You can get a Ferrari