Re: SQL questions???

From: Henry Talbot <talbot_at_idt.net>
Date: 1998/06/27
Message-ID: <35958771.1115073_at_news.idt.net>#1/1


Elton,

I'm not sure I completely understand what you want but I've used INTERSECT to do similar things, i.e.:

  ( SELECT * FROM Table1 WHERE CODE1 NOT IN ( '1', '2','3') )   INTERSECT
  ( SELECT * FROM Table1 WHERE CODE2 IN ('A', 'B', 'C') ) ;

This will give you all the rows in Table1 where CODE1 is NOT 1,2 or 3 and CODE2 is A,B or C.

If you didn't want the rows CODE2 equal to A,B,C use MINUS instead of INTERSECT. Just my 2 cents worth.

Good Luck,
Hank Talbot   

On Mon, 15 Jun 1998 13:13:54 +0200, michael ringbo <mri_at_dde-nospam.dk> wrote:

>Hi Elton
>
>Your example select won't work: at least you have to select 1 column from
>the nested select, not *.
>I guess what you want is the records from table1 where code1 is either '1'
>or '2' or '3' while code2 is either 'A' or 'B' or
 

>Elton Chan wrote:
>
>> Hi all,
>>
>> Anybody know how to replace 'NOT IN' operator by other operations?
>>
>> SELECT * FROM TABLE1 WHERE
>> CODE1 NOT IN (
>> SELECT * FROM TABLE1 WHERE
>> ( CODE1 = '1' OR CODE1 = '2' OR CODE1 = '3' )
>> AND
>> ( CODE2='A' OR CODE2='B' OR CODE2='C')
>> );
>>
>> ANY clue??? I've tried to use outer join, but it cannot be used with OR
>> operation...
>>
>> Thanks,
>> Elton
Received on Sat Jun 27 1998 - 00:00:00 CEST

Original text of this message