troubleshooting Question

Need help with Access query to delete records

Avatar of Gerhardpet
GerhardpetFlag for Canada asked on
DatabasesMicrosoft Access
5 Comments1 Solution302 ViewsLast Modified:
I have 2 tables in Access and in Table1 I want to find records without matching records in Table2 and then delete them from Table1.

Below I have a query that will find records in ADDRESS table without matching records in LOCAL_ADDRESS table. Now all I need to know how I could get the same query to delete unmatched records in the ADDRESS table.

Can anyone help me with this?

SELECT ADDRESS.RECORD_TYPE, ADDRESS.CEV_NO, ADDRESS.ADDR_TYPE, ADDRESS.ID, ADDRESS.NAME
FROM ADDRESS LEFT JOIN LOCAL_ADDRESS ON (ADDRESS.ID = LOCAL_ADDRESS.ID) AND (ADDRESS.ADDR_TYPE = LOCAL_ADDRESS.ADDR_TYPE) AND (ADDRESS.RECORD_TYPE = LOCAL_ADDRESS.RECORD_TYPE) AND (ADDRESS.[CEV_NO] = LOCAL_ADDRESS.[CEV_NO])
WHERE (((LOCAL_ADDRESS.CEV_NO) Is Null));
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros