Re: real beginner PL/SQL question
From: Kaboel Karso <Kaboel.Karso_at_pureatria.com>
Date: 1996/11/19
Message-ID: <329287F4.653F_at_pureatria.com>#1/1
Date: 1996/11/19
Message-ID: <329287F4.653F_at_pureatria.com>#1/1
Jim Smith wrote:
>
> In article <ron.heeb-1111961630420001_at_rheeb.csun.edu>, Ron
Heeb
> <ron.heeb_at_csun.edu> writes
> >how do i delete rows that are in one table but not in the other? i.e.
> >table A has id's of 1,2,3,4,7,8 and table B has 1,2,3,4,5,6,7,8; how do i
> >identify and delete 5 and 6 based on not existing in table A? thanks in
> >advance, ron
> >
> delete from b
> where b.id not in (select id from a)
> --
> Jim SmithHi Jim,
If you have big tables I suggest you use an outer
join and restrict the result to a.id is null. This
is much faster.
cheers,
Received on Tue Nov 19 1996 - 00:00:00 CET