Delete Query using linked table

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

Guest

I have certain criteria in one table and want to linkt it another table and
delete the matching records, the criteria matches three fields. Can Access do
this? I have tried but I get a meesage saying "cannot delte from specified
table".
The syntax is:
DELETE States.*
FROM Regions INNER JOIN (States INNER JOIN RegionAssignment ON
States.Abbreviation = RegionAssignment.Abbreviation) ON Regions.RegionID =
RegionAssignment.RegionID;
What am I doing wrong?
TIA for your help
Joe
 
DELETE DistinctRow States.*
FROM Regions INNER JOIN (States INNER JOIN RegionAssignment ON
States.Abbreviation = RegionAssignment.Abbreviation) ON Regions.RegionID =
RegionAssignment.RegionID;

IF that fails, you may have to use a subquery in a where clause

DELETE DistinctRow States.*
FROM STATES
WHERE States.Abbreviation in
(SELECT RegionAssignment.Abbreviation
FROM RegionAssignment INNER JOIN Regions
ON RegionAssignment.RegionID =Regions.RegionID)

As always TEST on a COPY of your data to make sure this does what you want
it to do.
 

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

Back
Top