Delete Duplicates That Match Another Table

B

Bryan Hughes

Hello,

What is the best way to create a Delete Duplicates Query That Match criteria
from anoter table?

-Bryan
 
M

Michel Walsh

Hi,


The easiest solution is to make the SELECT query with the inner join and
once you have got the records to be deleted nicely selected, change the
query type from a SELECT to a DELETE query type.

One of the pitfall is to specify the table from which you delete the
records: have one, but just one table. with a tableName.* in the first
step (before changing the query type).

The solution you would get is only valid in Jet. For a more universal
solution, the query could be like:


DELETE FROM Table1 WHERE Table1.Key1 IN (SELECT Key1 FROM Table2)



Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top