Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: NOT USING A NOT IN SQL
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
![]() |
![]() |