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 disable triggers using "disable trigger"?
You notice that the transaction log on one of your databases is over 4gb the size of the data file is 2mb what could cause this situation, and how can you fix it?
Explain transaction server implicit?
Please explain the characteristics of a transaction server for example atomicity, consistency, isolation, durability?
What is a join in sql?
mention different types of relationships in the dbms?
Explain the first normal form(1nf)?
How to make conditional sum in ssrs?
What is the use of sign function?
What are dml (data manipulation language) statements in ms sql server?
Why truncate is ddl?
what are isolation levels? : Sql server database administration
How to name query output columns in ms sql server?
What are the components of sql server service broker?
How to select true false based on column value in sql server?