Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is the difference between ddl and dml?

1005


How to delete multiple rows with one delete statement in ms sql server?

942


How to loop through result set objects using mssql_fetch_array()?

1021


Can you explain full-text query in sql server?

972


Do you know what are acid properties?

1018


Define model database?

935


What encryption security is available in sql azure?

99


Which are the two editions in which SQL Azure database available?

117


Why do we need different type of parameter?

999


how many no of arguments can be passed in procedures and functions

5466


Why is sql server log file full?

979


How to convert binary strings into integers in ms sql server?

963


What is the sql case statement used for? Explain with an example?

941


What is transactional replication?

907


Explain how to maintain a fill factor in existing indexes?

929