0
How to delete duplicate records from table without copying data to another table ...
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) ;
- 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);