How to retrieve duplicate rows in a table?
How to delete the duplicate entries in a table?
Answer Posted / mon
DELETE FROM MyTable
LEFT OUTER JOIN (
SELECT MIN(RowId) as RowId, Col1, Col2, Col3
FROM MyTable
GROUP BY Col1, Col2, Col3
) as KeepRows ON
MyTable.RowId = KeepRows.RowId
WHERE
KeepRows.RowId IS NULL
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is key set driven?
What is the meaning of lock escalation and why/how to stop this? : sql server database administration
What is sql language?
Explain the collation?
How to fetch the next row from a cursor with a "fetch" statement?
How do I start sql server 2016?
How many databases can we create in a single server?
What are the different types of columns types constraints in the sql server?
what is database replicaion? What are the different types of replication you can set up in sql server? : Sql server database administration
What is sharding?
what is the sql equivaent of the dataset relation object ?
What are clustered and non-clustered index?
Tell me what do we need queues in sql service broker?
Explain transaction server isolation?
Do you know what is difference between index seek vs. Index scan?