[thelist] Weird SQL problem with INTERSECT and UNION

Ken Schaefer ken at adOpenStatic.com
Wed Apr 2 01:06:33 CST 2003


I see no T-SQL function "intersect" in my copy of Books Online...

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: <tss24 at cornell.edu>
Subject: [thelist] Weird SQL problem with INTERSECT and UNION


: 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?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


More information about the thelist mailing list