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: Find and delete duplicates, how?

Re: Find and delete duplicates, how?

From: Phil Hoggins <philh_at_sequent.com>
Date: 4 Feb 1999 17:10:58 GMT
Message-ID: <01be5061$33534ea0$ab75549e@w-philh02.uk.sequent.com>


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

Original text of this message

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