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
How can i Relate Tables in SSIS
What kind of problems occurs if we do not implement proper locking strategy?
What are the types of subscriptions in SQL Server replication?
What is row_number()?
How do I start sql server 2016?
Mention the uses of stored procedures.
What is the filtered index?
Which event (check constraints, foreign key, rule, trigger, primary key check) will be performed last for an integrity check?
What is pessimistic concurrency?
What is the difference between a unique key and primary key?
How many categories of functions based their return modes?
What are truncate options available in sql server? : sql server database administration
Explain Capacity planning to create a database? and how to monitor it?
Explain acid?
What is a covering index?