Write a query to delete duplicate records in SQL SERVER
Answer Posted / shashank shrivastava
Table-admin
------------------
adminID adminName
1 admin
2 tester
3 admin
SQL:
---------------
DELETE admin.* FROM admin,
(SELECT count(adminName) as c, MAX(adminID) as m from
admin GROUP BY adminName HAVING c>1) as new_admin
WHERE admin.adminID=new_admin.m
| Is This Answer Correct ? | 1 Yes | 5 No |
Post New Answer View All Answers
How you can change the database name in SQL SERVER?
What are sql servers used for?
Where to find ntwdblib.dll version 2000.80.194.0?
What happens if strings are casted into wrong code pages in ms sql server?
What are the different types of collation sensitivity?
How to start and end transact-sql statements?
What is the full meaning of dml?
How do I find the sql server version?
What is an execution plan? How would you view the execution plan?
How to insert multiple rows with one insert statement in ms sql server?
How to use subqueries in the from clause in ms sql server?
what is nonclustered index
How do you open a cluster administrator?
How to run queries with sql server management studio express?
What are the new scripting capabilities of ssms? : sql server management studio