Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Q: Find and delete duplicates, how?

Re: Q: Find and delete duplicates, how?

From: Gjlinker <gjlinker_at_aol.com>
Date: 07 Feb 1999 18:26:43 GMT
Message-ID: <19990207132643.13258.00000002@ngol03.aol.com>

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

LLLL
LLLLLLLLLLLLLLLLLLLLLLLLLLLL

L Linker IT Consulting Ltd L
LLLLLLLLLLLLLLLLLLLLLLLLLLLL



Received on Sun Feb 07 1999 - 12:26:43 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US