how to delete duplicate rows from a specified table(only
single table)
how do you know which join is need to be used

Answer Posted / jas

delete from table_name where rowid > (select min(rowid)
from table_name where a.col_name=b.col_name)

create new_table as select distinct * from table_name;
drop table_name;
create table_name as select * from new_table;
drop new_table;

delete from table_name where rowid not in (select max
(rowid) from table_name where a.col_name=b.col_name)

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between count 1 and count (*) in a sql query?

687


Why should I use postgresql?

793


what's the difference between a primary key and a unique key? : Sql dba

729


Does sql require a server?

733


What is view? Can we update view

1104


In what condition is it good to disable a trigger?

779


What do you mean by stored procedures? How do we use it?

740


What is dml and ddl?

735


define sql insert statement ? : Sql dba

777


What is the main difference between sql and pl/sql?

787


How do you delete a table?

799


What is write ahead logging in sql server?

786


List the ways to get the count of records in a table?

680


What is the difference between delete and truncate commands?

715


what is row? : Sql dba

958