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

What is sql or structured query language?

1208


Can you index views?

951


How to convert numeric expression data types using the cast() function?

1138


What is normalization and what are the advantages of it?

1044


What is temporary table in sql server? Why we use temp table?

1004


How efficient you are in oracle and SQL server?

1241


Why and when do stored procedure recompile?

1044


Where can you add custom error messages to sql server?

1193


How to rebuild the master database?

1150


What are wait types?

1227


If you're given a raw data table, how would perform etl (extract, transform, load) with sql to obtain the data in a desired format?

1037


How to provide default values to function parameters?

1241


How do I find the sql server version?

1096


What is sql server query analyzer?

1114


What is a scheduled job or what is a scheduled task?

1027