Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

eliminating Duplicate Rows from a table

Status
Not open for further replies.

Stevenson

Programmer
Feb 4, 2001
10
US
Hi,

I'd like to know the query which uses Rowid stuff to elimante duplicate rows
from a table

thanx
Steve
 
Here is a piece of code which gives rowids,empno of emp1 table

select rowid,empno from emp1
where empno in (
select empno from emp1
group by empno
having count(*) > 1
)
/

Hence you can delete any duplicates/triplicates etc. based on the rowid. It is to delete employees having duplicate empno.

Hope it will help you.
 
You can also try this:

delete from table_name t1
where t1.column_name in (select column_name
from table_name t2
where t1.rowid > t2.rowid
and t1.column_name = t2.column_name
Chidi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top