SQl string to DELETE unmatched entries

W

What-A-Tool

I want to delete all entries from tblCat1 that don't have a match in
tblCat3. The following SQL string will display these Unmatched entries - can
this same string be modified into a DELETE string so I can just delete them
all in one fell swoop. Nothing I try seems to work.

My SELECT string which works (generated by query wizard):
-------------------------------------------------------------------
SELECT tblCat1.*
FROM tblCat1 LEFT JOIN tblCat3 ON tblCat1.Cat1 = tblCat3.Cat1Lnk
WHERE (((tblCat3.Cat1Lnk) Is Null));

Last tried DELETE string generated by the query wizard:
-------------------------------------------------------------------
DELETE tblCat1.*
FROM tblCat1 LEFT JOIN tblCat3 ON tblCat1.Cat1=tblCat3.Cat1Lnk
WHERE (((tblCat3.Cat1Lnk) Is Null));

My structure is made up of :
tblCat1 [Cat1]
tblCat2 [Cat2], [Cat1_Lnk]
tblCat3 [ID_Lnk], [Cat3], [Cat2_Lnk], [Cat1_Lnk]

tblCat1.Cat1 ~1:M ~tblCat2.Cat1_Lnk ~Cascade update/delete
tblCat1.Cat1 ~1:M ~tblCat3.Cat1_Lnk ~Cascade update/delete

When I try to run this as a query, it tells me "Could not delete from
specified tables".
I can go in and maually delete a line from tblCat1 without a problem.

Any help would be greatly apreciated -
Thanks-
Sean Mc
 

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