Delete records based on a union query

J

jeremiah

I have created a union query to combine records from 2 tables into a single
table that allows me to find any duplicates between the 2 tables. In a form
I have set up a checkbox to to mark the records that I want to delete from
one of the tables used to create the union. So my criteria should be that if
the checkbox is marked yes in the union query, delete the corresponding
record from only the main table.

Haven't been able to figure this one out.
 
J

John W. Vinson

I have created a union query to combine records from 2 tables into a single
table that allows me to find any duplicates between the 2 tables. In a form
I have set up a checkbox to to mark the records that I want to delete from
one of the tables used to create the union. So my criteria should be that if
the checkbox is marked yes in the union query, delete the corresponding
record from only the main table.

Haven't been able to figure this one out.

A Subquery should do this:

DELETE * FROM tablename
WHERE uniqueID IN
(SELECT uniqueID FROM uniionquery WHERE checkbox = True);
 

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

Similar Threads


Top