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

How to replace given values with null using nullif()?

1040


why would you call update statistics? : Sql server database administration

1156


Explain about unique identifier data type in sql server?

974


Explain transaction server isolation?

1079


List the ways in which dynamic sql can be executed?

1057


If I delete a template from the list in sql studio, will it be deleted from the hard disk? : sql server management studio

1029


How to use “drop” keyword in sql server and give an example?

1188


Do you know what is difference between stored procedure and user defined function?

1146


What do you understand by a view? What does the with check option clause for a view do?

1054


Do you know what is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure?

1053


Describe the left outer join & right outer join. : sql server database administration

1035


how do you implement one-to-one, one-to-many and many-to-many relationships while designing tables? : Sql server database administration

1107


What is 3nf normalization form?

1166


How many types of triggers in sql server?

1089


What does indexation mean?

1030