Re: How to delete intersection of two tables?

From: Ted Dinh <ted_at_fezzywig.cus.com>
Date: 14 Apr 93 16:48:05 GMT
Message-ID: <2099_at_airgun.wg.waii.com>


In article <1993Apr14.074621.7524_at_daimi.aau.dk>, ludvig_at_daimi.aau.dk (Peter Hubel) writes:
|> Hi netters,
|>
|> I'm quite a novice into Oracle SQL and I have this
|> problem.
|>
|> I have two tables (T1 and T2) which have two fields
|> (let's call them A and B) in common. The goal is to
|> remove all rows in T1 which match a row in T2 w.r.t
|> A and B.
|>
|> I've tried something like
|>
|> DELETE FROM T1 x
|> WHERE A = (SELECT A FROM T2 y WHERE T1.B = T2.B)
|>
|> but it doesn't seem to work at all.
|>
|> Any suggestions, anybody?
|> Thanks in advance
|>
|> ---peter
|> --
|> ******************************************************************************
       

Try this

	delete from t1
	 where t1.a in 
	(select t2.b
	   from t2);

Hope this would help Received on Wed Apr 14 1993 - 18:48:05 CEST

Original text of this message