Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: NOT USING A NOT IN SQL

Re: NOT USING A NOT IN SQL

From: Kevin P. Fleming <kfleming_at_access-laserpress.com>
Date: Mon, 17 Aug 1998 15:13:28 GMT
Message-ID: <sMXB1.406$435.1559314@news.rdc1.az.home.com>


Well, the simplest way to recode this query would be:

SELECT C1 FROM TABLE1
MINUS
SELECT C2 FROM TABLE2 This will return all C1 values from TABLE1 that don't exist as C2 values in TABLE2. D S Tharpe wrote in message <35D845DE.41C67EA6_at_ornl.gov>...
>What are some equivalent ways of SQL coding to avoid a 'not'
>in the following sql clause. I'm vaguely familiar with
>'exists' and 'minus'. The rule I've heard is never use a not -
>it takes much longer to return a result. Does anyone have
>experience with not using a 'not'?
>
>select c1 from table where c1 not in(select c2 from another_table);
>
>(c1 and c2 would have similar values)
>
>Thank you in advance for any advice,
>
>D. Tharpe
Received on Mon Aug 17 1998 - 10:13:28 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US