Finding first line of duplicates for deletion

Tommy B

Registered User.
Local time
Today, 23:13
Joined
Feb 26, 2001
Messages
43
Hi Guys,

Hope you can help me out
smile.gif


What I am trying to do is identify duplicate records and delete them from my master table.

I used the wizard to create a duplicates query, it returns the two duplicate records side by side (in actual jfact about 45,000 records side by side!!!)Now what I really need it to do is return just one of the duplicate records as I need to keep one, just removing the duplicate...if that makes sense.

If there were less dupes i could do this manually with my current query by just selecting and removing the offending records...however i am dealing with thousands of them!!!

Is there a way I can get the dupes query to look for dupes and return just one of the records so I can bulk delete them without removing the original record and the duplicate?

Hope this makes sense!!!

Any help is much appreciated
smile.gif


Tommy B
 
The easiest way to do this if you don't care which record is saved is -
Create a new empty table with the primary key defined so that dupes cannot be added. Then build an append query that selects from the current table and appends to the new table. Once you are sure everything worked properly, delete or rename (if you want to save for a while) the current table and rename the new table to the current table name.
 
Excellent! This method works perfectly
smile.gif


Thanks for the help Pat!

Tom.
 
Pat Hartman wrote...

Hi there,

Pat wrote: "...The easiest way to do this if you don't care which record is saved is..."

Now, in my dbase I do care, since I have the data set such that the oldest record (by date or older autonumber) appears first in the duplicate set. How do I write the sql for DELETE only the older date (or lower autonumber)?

Or is there a VB solution to the same problem?
Thanks in advance any viewers.
 
Rich,
Change your sort so that the newest record is first (usually sort descending) if that's the one you want to save.
 

Users who are viewing this thread

Back
Top Bottom