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
How do I edit a stored procedure in sql server?
What is attribute? : sql server analysis services, ssas
What is shared lock?
What is indexing and its types?
How to disable triggers using "disable trigger"?
How to replace given values with null using nullif()?
Write a query to include a constraint, to check whether the employee salary is greater than 5000?
What is collation sensitivity?
How to write the storeprocedure with in the store procedure? and how can we write the store procedure with in a trigger vice versa? plz post me the exact answer?
What is the purpose of optimization?
When is update_statistics command used?
What is the difference between mysql and sql server?
‘Order by’ is not allowed in a view how can you sort information from a view?
What is use of except clause? How does it differ from not in clause?
what are constraints? Explain different types of constraints? : Sql server database administration