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
What are page splits?
Where are SQL server users names and passwords are stored in sql server?
Explain features and concepts of analysis services?
How to see the event list of an existing trigger using sys.trigger_events?
What do you mean by data manipulation language?
What samples and sample databases are provided by microsoft?
What is a subquery in a select query statement in ms sql server?
What is linked report?
How to use transact-sql statements to access the database engine?
how would you store your query in an SSRS report or a Database server?
Are all views updatable ?
What are system databases into sql server (2005/2008) : sql server database administration
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
How to perform key word search in tables?
What is star, snowflake and star flake schema? : sql server analysis services, ssas