Write a query to delete duplicate records in SQL SERVER
Answer Posted / deepak raheja
DELETE FROM A
WHERE (id NOT IN
(SELECT MAX(ID)
FROM A
GROUP BY name))
suppose i have table called A. A has two coloumn id
(identity) as int and Name as nvarchar. I have data like
this.
id Name
1 C
2 D
3 C
4 E
5 D
6 D
| Is This Answer Correct ? | 78 Yes | 57 No |
Post New Answer View All Answers
What are the operating modes in which database mirroring runs?
What are the properties of the relational tables?
What is Service Broker in sql server 2012?
How to use order by with union operators in ms sql server?
Explain a join?
What is database replication? What are the different types of replication you can set up in sql server?
What is Federation Root Database?
List the different normalization forms?
What is the Disadvantage of indexed sequential file.
Define left outer join?
Explain the database you used in your final year project?
What should be the fill factor for indexes created on tables? : sql server database administration
What is multilevel indexing?
Explain what are the different index configurations a table can have?
What are the different types of upgrades that can be performed in sql server?