Delete query with joined tables

lhather

New Member
Joined
Feb 4, 2003
Messages
45
I have two tables that are identical and joined fields that are the key value. One table has over 60,000 records, the other has only 700 or so which has a corresponding records in the larger table.

What I want is to delete the records from the larger table where they equal the records on the smaller table. I keep getting an error to specify the table I want the records deleted from, but cannot figure out how to identify that.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Perhaps this is the stucture you are looking for:

DELETE *
FROM [LargeTableName]
WHERE [MatchingField] In
(
SELECT [MatchingField]
FROM [SmallTableName])
 
Upvote 0
From Query Design Mode, simply change your query from Design View to SQL View. Then you will see the SQL representation of your query. Modify it to match the structure I provided.
 
Upvote 0

Forum statistics

Threads
1,224,598
Messages
6,179,814
Members
452,945
Latest member
Bib195

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top