delete unmatched results

pablofonto

Registered User.
Local time
Today, 04:11
Joined
Sep 8, 2005
Messages
79
Hello,

I have an unmatched query that I would like to convert to a delete query. I would like to be able to delete the unmatched records from two tables using one query. I tried something like this (below), but I get an error message stating "could not delete from specified tables". What am I missing?

DELETE PUBLICIST and STORYPERSON STEPS Old table.*
FROM [PUBLICIST and STORYPERSON STEPS Old table] LEFT JOIN [STEP TABLE] ON
[PUBLICIST and STORYPERSON STEPS Old table].Pernr = [STEP TABLE].Pernr
WHERE ((([STEP TABLE].Pernr) Is Null));

Please help!

thanks,

Pablo:confused:
 
DELETE PUBLICIST and STORYPERSON STEPS Old table.*
FROM [PUBLICIST and STORYPERSON STEPS Old table] LEFT JOIN [STEP TABLE] ON
[PUBLICIST and STORYPERSON STEPS Old table].Pernr = [STEP TABLE].Pernr
WHERE ((([STEP TABLE].Pernr) Is Null));

The bold table name should be enclosed in brackets.

The best practice is to not use blanks in object and/or control names. Using then causes coding problems.
 
I have an unmatched query that I would like to convert to a delete query......but I get an error message stating "could not delete from specified tables".

In the delete query, use a subquery instead of a join.

DELETE *
FROM [PUBLICIST and STORYPERSON STEPS Old table]
WHERE Pernr Not In (Select Pernr from [STEP TABLE]);
.
 
Thank you guys for your help!
I tried adding the brackets as llkhoutx suggested and still got the same error message.
The solution was to do a subquery as Jon K suggested.

Thank you both for your inputs!:)

Pablo
 

Users who are viewing this thread

Back
Top Bottom