Re: How to delete intersection of two tables?

From: Guy Vilquin <vilquin_at_cenatls.cena.dgac.fr>
Date: Wed, 14 Apr 1993 11:54:39 GMT
Message-ID: <1993Apr14.115439.644_at_cenatls.cena.dgac.fr>


In article <1993Apr14.074621.7524_at_daimi.aau.dk>, ludvig_at_daimi.aau.dk (Peter Hubel) writes:

|> 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.
|>
 

You have to write :

  DELETE FROM T1
  WHERE (A,B) IN (SELECT A,B FROM T2)


  • Guy VILQUIN *
  • Centre d'Etudes de la Navigation Aerienne,Toulouse,France *
  • E-mail: vilquin_at_cenatls.cena.dgac.fr *
Received on Wed Apr 14 1993 - 13:54:39 CEST

Original text of this message