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 is transaction server auto commit?
What is cursors?
Please explain go command in sql server?
What is the sql server 2000 version number?
Define left outer join in sql server joins?
What is the difference between varchar and varchar(max) datatypes?
What is default constraint in ms sql server?
Can we take the full database backup in log shipping?
How do I uninstall sql server 2014?
How many databases can we create in a single server?
Which are the third-party tools used in sql server and why would you use them?
Explain user defined functions?
Is it possible to import data directly from t-sql commands without using sql server integration services? If so, what are the commands?
You have a table ‘test’ which is a copy of northwind employee table you have written a trigger to update the field ‘hiredate’ with the current date
What is the use of for clause?