Index: wp-includes/query.php
===================================================================
--- wp-includes/query.php	(revision 6181)
+++ wp-includes/query.php	(working copy)
@@ -1064,12 +1064,16 @@
 		}
 
 		if ( !empty($q['tag_slug__and']) ) {
-			$count = 0;
-			foreach ( $q['tag_slug__and'] as $tag_and ) {
-				$join .= " LEFT JOIN $wpdb->term_relationships AS tr$count ON ($wpdb->posts.ID = tr$count.object_id) LEFT JOIN $wpdb->term_taxonomy AS tt$count ON (tr$count.term_taxonomy_id = tt$count.term_taxonomy_id) LEFT JOIN $wpdb->terms AS term$count ON (tt$count.term_id = term$count.term_id) ";
-				$whichcat .= " AND term$count.slug = '$tag_and' ";
-				$count++;
-			}
+			$tsql = "SELECT p.ID FROM $wpdb->posts p LEFT JOIN $wpdb->term_relationships tr ON (p.ID = tr.object_id) LEFT JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) LEFT JOIN $wpdb->terms t ON (tt.term_id = t.term_id)";
+			$tsql .= "WHERE tt.taxonomy = 'post_tag' AND t.slug IN ('" . implode("', '", $q['tag_slug__and']) . "')";
+			$tsql .= "GROUP BY p.ID HAVING count(p.ID) = " . count($q['tag_slug__and']);
+			$post_ids = $wpdb->get_col($tsql);
+			
+			if ( count($post_ids) )
+				$where .= "AND $wpdb->posts.ID IN (" . implode(', ', $post_ids) . ") ";
+			else
+				$where = "AND 0 = 1";
+
 			$reqtag = is_term( $q['tag_slug__and'][0], 'post_tag' );
 			if ( !empty($reqtag) )
 				$q['tag_id'] = $reqtag['term_id'];
