Use group by for meta key queries. Props filosofo. fixes #9167 for trunk

git-svn-id: http://svn.automattic.com/wordpress/trunk@10598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-02-19 19:17:06 +00:00
parent 5c82bfb14c
commit 92f96f913b
1 changed files with 1 additions and 5 deletions

View File

@ -1789,10 +1789,6 @@ class WP_Query {
$q['cat'] = implode(',', $req_cats);
}
if ( !empty($q['category__in']) ) {
$groupby = "{$wpdb->posts}.ID";
}
if ( !empty($q['category__in']) ) {
$join = " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";
$whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'category' ";
@ -1869,7 +1865,7 @@ class WP_Query {
}
}
if ( !empty($q['tag__in']) || !empty($q['tag_slug__in']) ) {
if ( !empty($q['category__in']) || !empty($q['meta_key']) || !empty($q['tag__in']) || !empty($q['tag_slug__in']) ) {
$groupby = "{$wpdb->posts}.ID";
}