You must use `WHERE (metakey, metaval) IN ( (4, 5), (5, 3) )`. (4, 5) value combination means "country data (4)" = "country_id = 5", and (5, 3) means "theme data (5)" = "theme_id = 3".

This allows to select `tour_id` values matched at least one of this conditions. But then you must group by `tour_id`, count distinct `(metakey, metaval)` pairs for each tour, and filter only those tours which shows this count equal to 2 (condition pairs count).

Obtaining `tour_id` you can obtain whole tour record from `tours` table. - [Akina][1]


  [1]: https://dba.stackexchange.com/users/150107/akina