I would like to know how to display my posts using a query based on multiple custom fields. I have been through the initial example in the codex and it worked quite well for just one custom field, but I need a query based on 4 or 5.
I tried to just add more in (as seen below) but that didn't work.
$querystr = "'
FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
WHERE wposts.ID = wpostmeta.post_id
AND wpostmeta.meta_key = 'model'
AND wpostmeta.meta_value = '".$model."'
AND wpostmeta.meta_key = 'city'
AND wpostmeta.meta_value = '".$city."'
AND wpostmeta.meta_key = 'state'
AND wpostmeta.meta_value = '".$state."'
AND wposts.post_status = 'publish'
AND wposts.post_type = 'post'
ORDER BY wposts.post_date DESC
Any help would be awesome. Thanks.