Thursday, August 27, 2009

How to delete duplicate records in sql database

It took me deleting ALL the records from my database before I figured out how to do this! :( My solution to the problem of duplicate records in the database relies on the fact that there is at least ONE column that has duplicate information. In my case I only had two records where there should have been one. So the code I used to remove one of the two duplicated records is as follows:

FROM [emailsTable] A, [emailTable] B
WHERE A.MessageID = B.MessageID

No comments:

Post a Comment