I made a mysql query to WordPress like this:
$querystr = "
SELECT $wpdb->posts.*
FROM $wpdb->posts, $wpdb->postmeta
WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id
AND $wpdb->postmeta.meta_key = 'where'
AND $wpdb->postmeta.meta_value = 'london'
LIMIT 0,50 ";
$pageposts = $wpdb->get_results($querystr, OBJECT);
In this way i can grab all posts with meta_key = "where"
and meta_value = london
The problem is that I've also got another meta_key
, "date"
and a meta_value
that contains the real date like "05-06-2013"
, "06-06-2013"
, etc.
How can I query all posts with meta "where" = "london"
and order by date using the data contain in meta "date" = "xx-xx-xxxx"
?