Home > Code > SQL Server > Delete duplicate records from the table in SQL Server

Delete duplicate records from the table in SQL Server

by Raja   on Feb 25, 2011   Category: SQL Server   |  Views: 904    |  Points: 25   |  Bronze 


Below script is very useful to delete the duplicate the records from the sql server table

delete from testtable where id not in (select min(id) from testtable group by dept, name)


Thanks
Raja.


Post Code  |  Code Snippet Home

User Responses


No response found, be the first to review this code snippet.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts