Re: real beginner PL/SQL question

From: Jim Mitchell <jmitchell_at_jimdesu.com>
Date: 1996/11/12
Message-ID: <MPG.cf25a31a638f3bb989693_at_news.us.net>#1/1


In article <ron.heeb-1111961630420001_at_rheeb.csun.edu>, ron.heeb_at_csun.edu says...
> 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
I think that this will work, but get someone else to verify this before you run it (I'm not strong w/ SQL).

DELETE FROM B
WHERE NOT EXISTS
(SELECT ID FROM A
 WHERE A.ID = B.ID); :)
jIM mITCHELL Received on Tue Nov 12 1996 - 00:00:00 CET

Original text of this message