Re: Complex Oracle delete SQL statement?

From: Jason Baugher <jason_at_baugher.pike.il.us>
Date: Tue, 20 Aug 2002 22:39:21 GMT
Message-ID: <Xns9270B39A6130jasonbaugherpikeilus_at_209.242.76.10>


"Brad Pybus" <brad_pybus7zwq_at_hotmail.com> wrote in news:gVx89.1232$Bd4.10540_at_dfw-service2.ext.raytheon.com:

>
>
> I can do this statement in SQL Server but I can not figure out how to
> do it in Oracle. I just want it to delete records in Table1.
>
>
> DELETE A
> FROM TABLE1 A, TABLE2 B, TABLE3 C
> WHERE A.MYKEY= B.MYKEY AND A.UNIQUEKEY = B.UNIQUEKEY
> AND B.MYKEY= C.MYKEY
> AND C.KEY1 NOT BETWEEN 'A' AND 'Z';
>
>
>
>

Here's one way - I'm willing to bet someone has a faster or better way, but this gets it done:

delete from table1 a where a.rowid in (select a.rowid from table1 a, table2 b, table3 c where a.mykey=b.mykey and b.mykey=c.mykey and a.uniquekey=b.uniquekey and c.key1 not between 'A' and 'Z');

-- 
Jason Baugher 
Virtual Adept Professional Consulting Services
1406 Adams St.
Quincy, IL 62301
(217) 221-5406
http://baugher.pike.il.us/virtualadept
jason_at_baugher.pike.il.us
Received on Wed Aug 21 2002 - 00:39:21 CEST

Original text of this message