[AccessD] deduplication

Gustav Brock Gustav at cactus.dk
Mon Jan 15 05:13:26 CST 2007


Hi John

If you just wish to delete the dupes, this method may be the simplest and fastest.
Bill Mitchell told me in January 2001 how to do that. The idea is twofold:

 - to Group By that or those field(s) defining what makes records dupes
 - pick the first unique ID of the dupes

Then delete all records in a set of dupes except that with the selected ID

<quote>

Make sure to make a backup & test it first. . .

1. Add an autonumber field if you don't have a PK.
2. Create a totals Query1 which shows GroupBy the name, and First of the PK.
3. Create a delete Query2 with the PK criteria like this:

Not In (Select FirstOfPK From Query1;)

When you run the delete Query2 it will delete everything _except_ the first occurrence of each name.

</quote>

If you don't have real dupes, you'll need to modify 2. and 3. as this:

2. Create a Query1 which selects TOP 1 PK and sorts ascending on all three significant fields.
3. Create a delete Query2 with the PK criteria like this:

Not In (Select PK From Query1;)

/gustav




More information about the AccessD mailing list