[AccessD] Eliminating duplicate rows

Gustav Brock gustav at cactus.dk
Fri Jun 13 05:08:41 CDT 2003


Hi Bruce

> Due to a (ahem) programming feature, I now have a table with several
> thousand rows of which hundreds are redundant.  I am loking for a way to
> delete the redundant rows.

You may use an idea I received once from Bill (William) Mitchell for a
similar job (is he still with us?).
The trick is the use of "Not In" which frees you from locking the main
table: 

<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>

Have fun.

/gustav



More information about the AccessD mailing list