Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Find and delete duplicates, how?
the sql below will give you the duplicate rows, once your sure about the
data you want to delete change it to a delete command.
select
col1, col1 ( what ever uniquely identifies the row)
from tab1 t
where exists (
select 0
from tab2 t2
where t2.col1 = t.col1
and t2.col2 = t.col2
and t2.rowid <> t.rowid
)
order by col1 , col2
;
Rune Lysbakken <lysbakke_at_online.no> wrote in article
<36b983d2.91680772_at_news.online.no>...
> 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?
>
> regds Rune
>
Received on Thu Feb 04 1999 - 11:10:58 CST