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
Can a table be moved to different filegroup?
What is an indice?
Can you import Microsoft Excel data to SSRS?
What is federation member?
Explain active/passive and active/active cluster configurations?
What is a self join in sql server?
How to choose all records from the table?
How do I start sql server agent automatically?
What happens if null values are involved in comparison operations?
When is update_statistics command used?
What is difference between unique and primary key?
How many columns can exist together per table?
How do I view a stored procedure in sql server query?
Define inner join in sql server joins?
Explain different types of Normalization.