[thelist] Weird SQL problem with INTERSECT and UNION

tss24 at cornell.edu tss24 at cornell.edu
Wed Apr 2 00:40:59 CST 2003


Hi guys!

So I've got this MS SQL problem and can't seem to 
figure it out.

If I run this query (notice only difference is cost):

((SELECT C.pid, C.cost, S.sname, P.pname 
   FROM Catalog C, Suppliers S, Parts P 
   WHERE C.pid=1 AND C.cost >0.00 
     AND C.sid=S.sid AND C.pid=P.pid) 

UNION 

(SELECT C.pid, C.cost, S.sname, P.pname 
  FROM Catalog C, Suppliers S, Parts P 
  WHERE C.pid=1 AND C.cost >10 
   AND C.sid=S.sid AND C.pid=P.pid)) 

I get the correct results in Query Analyzer.

However, if I change UNION to INTERSECT, I get an 
error near INTERSECT it says.

Any ideas? Am I doing something wrong with my 
INTERSECT query?

Thanks in advance

ted


More information about the thelist mailing list