Write a query to delete duplicate records in SQL SERVER

Answer Posted / vinod singh kushwah

Delete From Tablename where(ID Not in (Select max(ID) from
Tablename Group by name))

Tablename :Friend

ID Name Age city
101 vinod 22 Gwalior
102 Pritesh 23 Gwalior
102 Pritesh 23 Gwalior
103 Arvind 24 Gwalior


Here Id-102 is repeated so friend if u want to delete this
duplicate raw Try Above code in Sql-sever

Is This Answer Correct ?    4 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between joins and subqueries?

543


Is there any performance difference between if exists (select null from table) and if exists (select 1 from table)?

535


How do database indexes work?

547


What is the maximum size of a dimension? : sql server analysis services, ssas

568


Name 3 ways to get an accurate count of the number of records in a table?

582






What does indexation mean?

537


What are the different authentication modes in sql server? How can it be changed?

577


How to create dbo table in sql server?

532


What language is sql server written in?

534


What is shrink log file?

518


Explain the database you used in your final year project?

550


Does group by or order by come first?

548


What is filestream?

564


How to specify the collation for a character data type in ms sql server?

565


What is a bit datatype?

570