Duplicate records
how to eliminate duplicate records in sql server?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Soft CornerRank #1,221 · 1.5K reputationPosted Mar 4, 2011, 12:07 AM EST
Delete all the duplicates using CTE (Common table expression) and ROW_NUMBER(), which is a new in SQL server 2005 and above.
Refer this Article : - Remove Duplicate Records
Lalit MRank #1,186 · 1.5K reputationPosted Mar 4, 2011, 12:13 AM EST
DELETE
FROM MyTable
WHERE ID NOT IN
(
SELECT MAX(ID)
FROM MyTable
GROUP BY DuplicateColumn1, DuplicateColumn2, DuplicateColumn3)
OR
SELECT DISTINCT * INTO DuplicateTb FROM dublicatetest GROUP BY sname,rno HAVING COUNT(rno) > 1
will get more details below link
http://www.kodyaz.com/articles/delete-duplicate-records-rows-in-a-table.aspx
Suthish NairRank #92 · 22.8K reputationPosted Mar 7, 2011, 9:20 AM EST