I want to select post_id where (meta_key = group_name and meta_value = Caucaia) and (meta_key = _featured and meta_value = 1)
Table: wp_postmeta
post_id | meta_key | meta_value
---------------------------
746 | group_name | Caucaia
746 | _featured | 1
747 | group_name | Caucaia
747 | _featured | 0
1791 | group_name | Aruba
1791 | _featured | 1
I tried the below query but doesn't works
SELECT `post_id` FROM `wp_postmeta` WHERE (`meta_key` = 'group_name' and `meta_value` ='Caucaia' and `post_id` in (746, 747, 731, 1791, 1799)) or (`meta_key` = '_featured' and `meta_value` ='1' and `post_id` in (746, 747, 731, 1791, 1799)) GROUP BY `post_id`
How do I make query to select from multiple row? or is there any other way?