0

How to delete duplicate records from table without copying data to another table ...

26th Aug 2016, 4:58 AM
naresh
2 Réponses
0
Delete from table_name where (rowid, columns name) not in (select min(rowid), column_name from table_name group by column_name) ;
31st Aug 2016, 2:50 AM
Kirtiranjan Sahoo
Kirtiranjan Sahoo - avatar
- 1
If you are using SQL Server, you could use DELETE TOP 1. Ex: Suppose you have a table as below: id name --------------- 1 Tiger 2 Cat 1 Tiger 4 Monkey 2 Cat ----------------- DELETE TOP 1 FROM table1 WHERE id IN (SELECT id FROM table1 GROUP BY id HAVING COUNT (*)>1);
26th Aug 2016, 6:00 AM
Tiger
Tiger - avatar