Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

charl99cfc on "Custom WP query on multiple meta_keys and meta_values"

$
0
0

Hi all

Am trying to query multiple meta_keys & meta_values, but not getting the query right.

$queryall = "SELECT DISTINCT(post_id) FROM wp_postmeta WHERE (meta_key = 'mb_category' AND meta_value = 'To Let') ORDER BY post_id DESC";

$queryall = "SELECT DISTINCT(post_id) FROM wp_postmeta WHERE (meta_key = 'mb_property-type' AND meta_value = 'id119') ORDER BY post_id DESC";

Need to combine the two queries.
Do i need to do an inner join or left join... Can someone please assist or advise?

Regards,
Charl


Viewing all articles
Browse latest Browse all 8245

Trending Articles