Write a query to delete duplicate records in SQL SERVER

Answer Posted / anuj dhingra

DELETE
FROM MyTable
WHERE ID NOT IN
(
SELECT MAX(ID)
FROM MyTable
GROUP BY DuplicateColumn1, DuplicateColumn2,
DuplicateColumn2)

Is This Answer Correct ?    12 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between group by clause and having clause in SQL?

567


How many tables can be joined in SQL Server?

594


Can we use where clause with group by?

521


What are different types of roles provided by ssrs?

112


How do I find query history in sql server?

518






What is indexing in sql server with example?

525


Explain Normalization and DE normalization

608


Suppose you want to implement the one-to-one relationships while designing tables. How would you do it?

547


What is SQL Azure Data sync?

105


What is meant by indexing?

508


What the different types of Replication and why are they used?

543


How many joins in sql server?

518


What is report snapshot in ssrs?

166


What is named query? : sql server analysis services, ssas

517


How to attach adventureworkslt physical files to the server?

634