Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Delete records
Hi,
Try this .It works
DELETE FROM TABLE1 A
WHERE NOT EXISTS (
SELECT '1' FROM TABLE2 B, TABLE3 C WHERE A.ID = B.ID OR A.ID = C.ID);
AMARENDRA NETTEM
Oracle DBA
Casper Thrane wrote:
> Hi!
>
> I have got this problem.
> I have to delete all records from one table that doesn't exist in two
> other tables.
>
> table 1
> id
> 1
> 2
> 3
> 4
> 5
> 6
>
> table 2 table 3
> id id
> 2 5
> 3 6
>
> I want to delete all records from table 1 that has been left over, if
> you combine table 2 and table 3. This means in this case, that I want to
> delete id 1 and 4.
>
> Casper Thrane
-- ***************************************************************** AMARENDRA B NETTEM Oracle Certified DBA (OCP) Whittman-Hart Inc., 311 South Wacker Drive, Suite 3500 Chicago, IL 60606. Residence: ----------- 5039 N E River Road, Apt. 1A NORRIDGE, IL 60656 Ph.No. (708) 583 9870 (H) (312) 913 6758 (W) E-mail:nettama_at_charlie.cns.iit.edu, anettem_at_whittman-hart.com Homepage: http://www.iit.edu/~nettama **************************************************************** Opinions are mine and do not necessarily reflect those of Whittman-hart Inc.Received on Thu Feb 12 1998 - 00:00:00 CST
![]() |
![]() |