[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[CF-Database] Deleting duplicates from a database



I have a SQL Server database and a whole load of duplicates in one table based upon about 5 fields. I can easily find out which records are duplicated using HAVING COUNT(*) > 1, but I can't simply figure out how to delete all but 1 of the records.

The idea currently is to copy each one into a temp table, via the GROUP BY function, and then delete those in the original table, and then re-insert from the temp table.

What do you think?  Is this the right way or am I missing something?

Paul