Select from wp_post and multiple meta_value from wp_postmeta
You need to join the post_meta table twice to the posts table, once for each meta value: SELECT p.ID id, p.post_title title, country.meta_value country, region.meta_value region FROM {$wpdb->posts} p JOIN {$wpdb->postmeta} country ON p.ID = country.post_id AND country.meta_key = ‘search_country’ JOIN {$wpdb->postmeta} region ON p.ID = region.post_id AND region.meta_key = ‘search_region’ WHERE p.post_status=”publish” AND p.post_type=”films” … Read more