On Wed, 3 Nov 2004, Chaitra Yale wrote: > ...how can union be the same as intersect..iam trying to get the names > of comapnies that are in both queries.....for example the first query > gives me companies A, B AND C and the second query gives A , B..i want > the intersect of these 2 queries....so i get companies A and B...if i > did a union i will get A, B and C
Could use the union in a subquery together with a HAVING COUNT(*) on the outside. SELECT * FROM ( SELECT DISTINCT col1 FROM t1 WHERE... UNION ALL SELECT DISTINCT col1 FROM t1 WHERE... ) AS tbl GROUP BY tbl.col1 HAVING COUNT(*) = 2 Or something... not sure how well that would performe, however. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]