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

What is wrong with sql server client libarary dll, ntwdblib.dll?

1033


What are the different ways you can create databases in sql server?

1092


Does order by actually change the order of the data in the tables or does it just change the output?

1130


Mention the uses of stored procedures.

962


What are the properties of the transactions?

1109


what is the difference between writing data to mirrored drives versus raid5 drives. : Sql server administration

960


How does the report manager work in SSRS?

148


How to get the query of a table in sql server?

887


What is best institute to Learn DotNET And SQL in chennai?

2158


Do you know what is xpath?

1075


Define cross join in sql server joins?

1012


Can I work with several databases simultaneously? : sql server management studio

978


What do you mean by acid?

983


How many levels of sp nesting is possible?

1045


When would you prefer to have a minimum number of indexes?

894