Remove Duplicate Records

Create a new empty table except set the fields that you don''t want duplicated as primary key and then dump the entire table from old to new and all the duplicated records will get bumped out as they violate the primary key. You will end up with a clean list of non-duplicate records. You can then reset the primary key to your liking.


You could also create a new table with DISTINCT records:

SELECT DISTINCT townID, Place_ID, Town INTO new_table FROM old_table

Then you could delete the old table or just rename it in case you need to do the query again. Finally rename the new table to reflect the name of the old table.

Source: Allen Chen, Carey.Walker [aspSQLhowto] asplists.com
Viewed 4200 times