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

Can sql servers linked to other servers?

1027


How to get nth highest salary from employee table.

1155


What is the purpose of sql profiler in sql server?

1005


What is transaction server explicit transaction?

1021


Explain the use of containers in ssis?

943


Please explain go command in sql server?

1037


Do you know what is a with(nolock)?

1047


What is difference between Datepart() and Datename() in SqlServer?

1195


What is abstracting periodical?

934


How to rebuild indexes with alter index ... Rebuild?

1110


What is meant by dirty read?

983


if no size is defined while creating the database, what size will the database have? : Sql server administration

986


Please explain that what are the basic functions for master, msdb, model, tempdb and resource databases? : SQL Server Architecture

958


What are the difference between “where” and “having” clause in sql server?

1057


What is a document index?

1018