Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Q: Find and delete duplicates, how?
Dear all,
>I want to create an unique index but I have som duplicate values. I
>think I can find them with a combination of count, group and having
>Count ()> 1 but how can I delete so that only one of the duplicates
>remains?
Use a SQL statement like this:
delete from emp a
where exists
( select 1 from emp b where a.empno = b.empno and a.rowid > b.rowid)
Regards Gerrit-Jan Linker,
*| Gerrit-Jan Linker : gjlinker_at_aol.com *| *| http://members.aol.com/gjlinker *| *| Developer of: *| Oraxcel, OraWeb, OraSQL, OraCodes and OraDebug ************************************************* LLLL IIII TTTTTTTTTTTT LLLL IIII TTTTTTTTTTTT LLLL IIII TTTT LLLL IIII TTTT LLLL IIII TTTT LLLL IIII TTTT LLLL IIII TTTT LLLL IIII TTTT LLLL IIII TTTT
LLLLLLLLLLLLLLLLLLLLLLLLLLLL
LLLLLLLLLLLLLLLLLLLLLLLLLLLLReceived on Sun Feb 07 1999 - 12:26:43 CST
![]() |
![]() |