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
What is save transaction and save point?
you added a row to a view, but the row is not shown on the view. Explain how this can happen, and how you can remedy the situation
How do you manipulate data?
Explain datetime2 data type in sal server 2008?
How to invoke a trigger on demand?
What is the difference between index seek vs. Index scan?
What do you mean by data manipulation language?
Which language rdl files made of?
Explain powershell included in sql server 2008?
what is difference between view and Dip.
How many columns can we include on clustered index ?
To automatically record the time on which the data was modified in a table, which data type should you choose for the column?
Recommend an approach to ensuring that all changes in the remote databases synchronize with the SQL Azure database?
After creating the cube, if we added a new column to the oltp table then how you add this new attribute to the cube? : sql server analysis services, ssas
What are examples of triggers?