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

Is delete faster than truncate?

547


How to make a copy values from one column to another in sql?

576


What is the difference between explicit and implicit cursors in oracle?

516


What are different methods to trace the pl/sql code?

544


Is sql harder than python?

612






What is a left join?

511


What is not equal in sql?

511


What are some emotional triggers?

570


Is subquery faster than join?

570


How does postgresql compare to oracle/db2/ms sql server/informix?

568


How do I install sql?

524


What is thread join () in threading?

542


when is the use of update_statistics command? : Sql dba

504


What packages are available to pl/sql developers?

603


explain what is mysql? : Sql dba

600