Delete query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table that has a number of records that contains the key field to
another table. I would like to delete those records in the other table where
the keys match. How can I write that query (I tried with a sub select, but no
luck.
Thanks,
Stan
 
Join the two tables, inner join by the connecting field and delete table 2
Please back up before trying

DELETE Table2.*
FROM Table1 INNER JOIN Table2 ON Table1.FieldName = Table2.FieldName

Or
DELETE Table2.* FROM Table2
WHERE Table2.FieldName In (SELECT Table1.FieldName FROM Table1)
 
Back
Top