I have this mysql table structure:
------------------------------------
| item_id | meta_key | meta_value |
------------------------------------
159 category Bungalow
159 location Lagos
159 price 45000
160 category Bungalow
160 location Abuja
160 price 53500
...
350 category Bungalow
350 location Lagos
350 price 32000
What I'd like to do is select several rows matching two or more criteria based on the meta_key column. For example, say I wanted to select the item_id for every 'Bungalow' located in 'Lagos'. How would I go about doing that?
Here's my attempt, which is not working:
SELECT `item_id` FROM `item_meta`
WHERE
`meta_key` = 'category' AND `meta_value` = 'Bungalow'
AND
`meta_key` = 'location' AND `meta_value` = 'Lagos'
Any help will be appreciated.