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


Please Help Members By Posting Answers For Below Questions

What is the difference between a check constraint and a rule?

633


What is tablix?

115


Tell about MOM Tool(Microsoft Operator Manager)?

1424


What is data modification?

519


What is instead of dml trigger?

600






What are the acid properties?

560


what is the difference between Delete and Truncate command in SQL

634


What is server-level principal?

102


What is check constraint in sql server?

533


Can You Use A Stored Procedure To Provide Data To An Ssrs Report?

109


What is table valued function and scalar valued functions?

498


Explain time data type in sal server 2008?

558


Can one drop a column from a table?

556


How to override dml statements with triggers?

591


What is an execution plan?

569