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 / deepak raheja

DELETE FROM A
WHERE (id NOT IN
(SELECT MAX(ID)
FROM A
GROUP BY name))

suppose i have table called A. A has two coloumn id
(identity) as int and Name as nvarchar. I have data like
this.

id Name
1 C
2 D
3 C
4 E
5 D
6 D

Is This Answer Correct ?    78 Yes 57 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can i Relate Tables in SSIS

1073


What kind of problems occurs if we do not implement proper locking strategy?

1395


What are the types of subscriptions in SQL Server replication?

1022


What is row_number()?

976


How do I start sql server 2016?

891


Mention the uses of stored procedures.

962


What is the filtered index?

1040


Which event (check constraints, foreign key, rule, trigger, primary key check) will be performed last for an integrity check?

994


What is pessimistic concurrency?

968


What is the difference between a unique key and primary key?

938


How many categories of functions based their return modes?

1095


What are truncate options available in sql server? : sql server database administration

1015


Explain Capacity planning to create a database? and how to monitor it?

4197


Explain acid?

1070


What is a covering index?

977