Wednesday, 2 July 2014

How to delete duplicate entries from table without deleting single entry in SQL

How to delete duplicate entries  from table without deleting single  entry in SQL


Suppose there are 5 duplicate  entries with same values in [MyTable] table, we have to keep only one entry in the table. 
When we  use the given code then 4 entries will be deleted


set rowcount 4
delete from MyTable where Myid =
set rowcount 0