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 to enter unicode character string literals in ms sql server?
What is meant by dirty read?
What are extended events in sql server?
What is ddl and dml commands?
What is use of attribute hierarchy optimized state? : sql server analysis services, ssas
Does index slows down insert statements?
What do I need to start working with sql studio? : sql server management studio
Do you know the cursor optimization tips?
What is server-level principal?
Explain Reporting Life Cycle?
You are designing a database for your human resources department in the employee table, there is a field for social security number, which cannot contain null values if no value is given, you want a value of unknown to be inserted in this field what is the best approach?
What are filegroups in sql server?
How do I start sql server 2016?
What are the different types of triggers in SQL SERVER?
What is efficiency data?