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 are the differences between left join and inner join in sql server?

1094


Can an entity have two primary keys?

975


How do you debug a procedure in sql server?

933


What is analysis service repository?

1020


What is the default fill factor value?

1072


What is the advantage of sql server?

1028


What do you mean by an execution plan?

1107


What are the advantages of passing name-value pairs as parameters?

1160


What is the difference between char, varchar and nvarchar?

1019


How raid can influence database performance?

1020


what is the different types of backups available in sql server? : Sql server database administration

917


What are the different index configurations a table can have?

954


Explain the different types of backups available in sql server? : sql server database administration

915


What is data modeling and Reterminal integrity?

1951


What does the on delete cascade option do?

1011