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 / anand

TABLENAME: testanand
DATA:
id vanme emailid age
-- ------ ---------- ------
1 Anand anand.kv@abc.com 29
2 Anand anand.kv@abc.com 28
3 Rajesh rajesh@abc.com 30
4 Rajesh rajesh@abc.com 31
5 Vinit vinit@abc.com 21
6 Vinit vinit@abc.com 25

DELETE FROM testanand WHERE id Not IN
(SELECT min(id) FROM testanand GROUP BY vname)

RESULTS:

id vanme emailid age
-- ------ ---------- ------
1 Anand anand.kv@abc.com 29
3 Rajesh rajesh@abc.com 30
5 Vinit vinit@abc.com 21

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is relationship? What number of sorts of relationship are there?

1063


Define tempdb database?

940


What is 4nf in normalization form?

950


Explain what are sparse columns?

929


How to delete multiple rows with one delete statement in ms sql server?

942


which backup strategy you are following at ur company

2103


Explain encryption of entire databases without the need for application changes in sql server 2008?

993


What do you mean by data manipulation language?

946


What are constraints?

957


How do you create a data source?

864


Do you know hot add cpu in sql server 2008?

898


Can a table be moved to different filegroup?

917


How will you monitor replication latency in transactional replication? : sql server replication

1086


What is the stuff?

947


Can another user execute your local temporary stored procedures?

939