Index: query.php
===================================================================
--- query.php	(revision 15530)
+++ query.php	(working copy)
@@ -2047,22 +2047,17 @@
 						$children = get_term_children($term->term_id, $taxonomy);
 						$term_ids = array_merge($term_ids, $children);
 					}
+
+					$join .= " INNER JOIN $wpdb->term_relationships tax_tr ON ($wpdb->posts.ID = tax_tr.object_id) INNER JOIN $wpdb->term_taxonomy tax_tt ON (tax_tr.term_taxonomy_id = tax_tt.term_taxonomy_id) ";
+					$whichcat .= " AND tax_tt.taxonomy = '$taxonomy' ";
+					$in_cats = "'" . implode("', '", $term_ids) . "'";
+					$whichcat .= "AND tax_tt.term_id IN ($in_cats)";
+					$groupby = "{$wpdb->posts}.ID";
 				}
-				$post_ids = get_objects_in_term($term_ids, $taxonomy);
-				if ( !is_wp_error($post_ids) && !empty($post_ids) ) {
-					$whichcat .= " AND $wpdb->posts.ID IN (" . implode(', ', $post_ids) . ") ";
-					if ( empty($post_type) ) {
-						$post_type = 'any';
-						$post_status_join = true;
-					} elseif ( in_array('attachment', (array)$post_type) ) {
-						$post_status_join = true;
-					}
-				} else {
-					$whichcat = " AND 0 ";
-				}
 			}
 		}
 
+
 		// Author/user stuff
 
 		if ( empty($q['author']) || ($q['author'] == '0') ) {
