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 is sql or structured query language?
Can you index views?
How to convert numeric expression data types using the cast() function?
What is normalization and what are the advantages of it?
What is temporary table in sql server? Why we use temp table?
How efficient you are in oracle and SQL server?
Why and when do stored procedure recompile?
Where can you add custom error messages to sql server?
How to rebuild the master database?
What are wait types?
If you're given a raw data table, how would perform etl (extract, transform, load) with sql to obtain the data in a desired format?
How to provide default values to function parameters?
How do I find the sql server version?
What is sql server query analyzer?
What is a scheduled job or what is a scheduled task?