delete query using more than one table

G

Guest

Hello, I'm trying to create a delete query using two tables. I want to
delete records from the first table and only use the second table for my
criteria. The following is example of the SQL that is created. It does not
work for some reason. Could someone please help? Thank you

DELETE FIRST_TABLE.*, FIRST__TABLE.Note
FROM FIRST_TABLE, [SECOND_TABLE]
WHERE (((FIRST_TABLE.Note)="Matched RRR,
RPP"+Format(Month!First_Date,"mmm")+" "+Format(Month!First_Date,"yyyy")));
 
J

John Spencer

Is there some kind of relationship between the two tables? Also, what is
Month!FirstDate?

Perhaps the following would work, but I would carefully test this on a copy
of the data. This was obviously a non-working query as it contained typing
errors. For example "First__Table" instead of "First_Table". Note the two
underscores.

DELETE DistinctRow FIRST_TABLE.Note
FROM FIRST_TABLE
WHERE FIRST_TABLE.Note IN
(SELECT "Matched RRR, RPP" & Format(First_Date,"mmm yyyy")
FROM [SECOND_TABLE])
 
G

Guest

Thank you John, I got it to work.

John Spencer said:
Is there some kind of relationship between the two tables? Also, what is
Month!FirstDate?

Perhaps the following would work, but I would carefully test this on a copy
of the data. This was obviously a non-working query as it contained typing
errors. For example "First__Table" instead of "First_Table". Note the two
underscores.

DELETE DistinctRow FIRST_TABLE.Note
FROM FIRST_TABLE
WHERE FIRST_TABLE.Note IN
(SELECT "Matched RRR, RPP" & Format(First_Date,"mmm yyyy")
FROM [SECOND_TABLE])

nicknameClair said:
Hello, I'm trying to create a delete query using two tables. I want to
delete records from the first table and only use the second table for my
criteria. The following is example of the SQL that is created. It does
not
work for some reason. Could someone please help? Thank you

DELETE FIRST_TABLE.*, FIRST__TABLE.Note
FROM FIRST_TABLE, [SECOND_TABLE]
WHERE (((FIRST_TABLE.Note)="Matched RRR,
RPP"+Format(Month!First_Date,"mmm")+" "+Format(Month!First_Date,"yyyy")));
 

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