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 happens if null values are involved in string operations?
How do you delete a data source?
What is b tree index?
Which rendering formats are affected by the pagesize properties?
How to write a query with a right outer join in ms sql server?
How to end a stored procedure properly in ms sql server?
Define cross join in sql server joins?
Tell me what are the advantages of using stored procedures?
What is equi join with example?
How do I completely remove sql server instance?
What are the different Authentication modes in SQL Server and how can you change authentication mode?
Explain what are the events recorded in a transaction log?
tell me what is blocking and how would you troubleshoot it? : Sql server database administration
Define a cross join?
Explain go command in sql server?