Delete Records using Query Builder

richlocus
2StarLounger
Posts: 154
Joined: 03 Oct 2015, 00:30

Delete Records using Query Builder

Post by richlocus »

Hello:

I have two input tables, for example:

Table 1 has 100 Records with a key field with values from A1 To A100
Table 2 has 10 Records with a key fields with values from A30 to A39

I have not found a way in query builder (In one query) to delete those 10 matching records in Table 1 using the values in Table 2, leaving 90 records in Table 1.

It seems like it should be so simple!

Thanks,

Rich Locus

User avatar
HansV
Administrator
Posts: 78394
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Delete Records using Query Builder

Post by HansV »

Like this:

DELETE [Table 1].*
FROM [Table 1] INNER JOIN [Table 2] ON [Table 1].[Key Field] = [Table 2].[Key Field]

S1163.png
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

richlocus
2StarLounger
Posts: 154
Joined: 03 Oct 2015, 00:30

Re: Delete Records using Query Builder

Post by richlocus »

Hans:
Thank you!
Rich Locus