'Delete' Query (1 Viewer)

PeteB

Registered User.
Local time
Today, 13:07
Joined
Mar 15, 2016
Messages
78
Hi All

I have created a 'Find Duplicates' query where all of three fields in any record must match for records to be duplicates.

I now want to create a 'Delete Duplicate' query to delete the 'unwanted' duplicates. I have tried following the Microsoft Help but the query I end up with wants to delete all of the records returned by the 'Find Duplicates' query. Let's just say we have only two absolutely identical records, except for the ID field, - I would want to delete only one of these records, but keep the other. How do I do this?

Would very much appreciate some help with this.
 

Ranman256

Well-known member
Local time
Today, 16:07
Joined
Apr 9, 2015
Messages
4,337
add a field,'mark'.
include this in the FindDuplicate query. Checkmark the dupes.
then run a delete query to remove the marked items.
 

plog

Banishment Pending
Local time
Today, 15:07
Joined
May 11, 2011
Messages
11,646
Identify the records you want to keep:

Code:
SELECT MIN(IDField) AS GoodID
FROM YourTableNameHere
GROUP BY DupeField1, DupeField2, DupeField3

Then delete from YourTableNameHere all records that don't have an IDField in the above query.
 

PeteB

Registered User.
Local time
Today, 13:07
Joined
Mar 15, 2016
Messages
78
add a field,'mark'.
include this in the FindDuplicate query. Checkmark the dupes.
then run a delete query to remove the marked items.

Hi Ranman - thanks for your quick response - I'm not familiar with field 'mark' - can you expand on this please?
 

Users who are viewing this thread

Top Bottom