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 in sql server

Answer Posted / manjeet kumar

delete from table_name where column_name='value' and rowid
not in (select max(rowid) from table_name where
column_name='value');

e.g. create table duplicate (name varchar(15), rollno number
(10));

insert into duplicate (name,rollno) values ('mkumar',2);
insert into duplicate (name,rollno) values ('mkumar',2);

delete from duplicate where name='mkumar' and rowid not in
(select max(rowid) from duplicate where name='mkumar');

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are page splits?

986


Where are SQL server users names and passwords are stored in sql server?

1238


Explain features and concepts of analysis services?

957


How to see the event list of an existing trigger using sys.trigger_events?

1055


What do you mean by data manipulation language?

989


What samples and sample databases are provided by microsoft?

1022


What is a subquery in a select query statement in ms sql server?

1114


What is linked report?

129


How to use transact-sql statements to access the database engine?

1041


how would you store your query in an SSRS report or a Database server?

161


Are all views updatable ?

1133


What are system databases into sql server (2005/2008) : sql server database administration

994


but what if you have to create a database with two filegroups, one on drive c and the other on drive d with log on drive e with an initial size of 600 mb and with a growth factor of 15%? : Sql server database administration

949


How to perform key word search in tables?

947


What is star, snowflake and star flake schema? : sql server analysis services, ssas

1130