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 happens if null values are involved in string operations?

1028


How do you delete a data source?

1048


What is b tree index?

966


Which rendering formats are affected by the pagesize properties?

151


How to write a query with a right outer join in ms sql server?

960


How to end a stored procedure properly in ms sql server?

1143


Define cross join in sql server joins?

1078


Tell me what are the advantages of using stored procedures?

1062


What is equi join with example?

1226


How do I completely remove sql server instance?

1151


What are the different Authentication modes in SQL Server and how can you change authentication mode?

1125


Explain what are the events recorded in a transaction log?

1050


tell me what is blocking and how would you troubleshoot it? : Sql server database administration

941


Define a cross join?

1084


Explain go command in sql server?

1090