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 are filegroups in sql server?
What is the purpose of self join?
Explain in details security in SQL azure?
In which tcp/ip port does sql server run? Can it be changed?
What is the purpose of sql profiler in sql server?
what are the reporting service components in SSRS?
what is a schema in sql server 2005? Explain how to create a new schema in a database? : Sql server database administration
Can we use where clause in union?
What are the different types of data sources in ssrs?
explain different types of constraints? : Sql server database administration
What is optimistic concurrency?
What is difference between rollback immediate and with no_wait during alter database?
If you're given a raw data table, how would perform etl (extract, transform, load) with sql to obtain the data in a desired format?
What is inner join in sql server joins?
How to create an index on an existing table in ms sql server?