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...

how to delete duplicate rows from table

Answer Posted / navaneethakrishnan

Hi Kumar,

Yes it will delete only the id=1, you have to change the
id=2 whichever u want...

DELETE TOP(1) FROM [tblduplicate] WHERE [ID] = 2
DELETE TOP(1) FROM [tblduplicate] WHERE [ID] = 3

For ur kind information,.. it will delete the duplicate
records only if there is exactly 2 duplication...... if the
id 1 will entered to three times, this query will delete
only one record... because

as we enterd the query as top(1)it will select the top
most and delete the record..


This is the simple query to execute.... there is other ways
also.. to do....


Now use this query to do for more than 2 duplication

DELETE TOP(SELECT COUNT(*) -1 from dbo.tblduplicate where
id = 1)
from dbo.tblduplicate
where id = 1

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can another user execute your local temporary stored procedures?

988


Hi all, can any one please tell me the difference between sql server 2008 and orace 9i

1958


How to test values returned by a subquery with the in operator?

1197


What are the new data types are introduced in sql 2000?

907


What is checkpoint in sql server?

1165


what is a self join? Explain it with an example? : Sql server database administration

953


what is difference between view and Dip.

2410


What can be used instead of trigger?

1156


What is the purpose of sql profiler in sql server? : sql server database administration

1108


How to trouble shoot if unable to connect SQL Server

1992


What is an identity column in insert statements?

1023


What are the different types of Indexes available in SQL Server?

1008


Tell me what is log shipping?

977


How many types of database relationship in sql server?

1055


What is buffer cash in sql server?

1155