Hi can you pls any one let me know" How to delete duplicate records from a table in oracle 9i

It is better to start a different thread for a new question.

anyways try to use this sample query

DELETE FROM emp e  WHERE rowid>(SELECT MIN(ROWID) FROM emp WHERE e.empno=empno)
commented: :cool: +4

You can also use this sample query with a different logic

DELETE FROM emp  WHERE ROWID NOT IN(SELECT MAX(ROWID) FROM emp GROUP  BY empno)

what a piece code :)

I am glad to share my knowledge .

to delete 1st row in table

delete from emp where rowid in (Select min(rowid) from emp );

to delete last or latest row in table

delete from emp where rowid in (Select max(rowid) from emp );
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.