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

Home -> Community -> Usenet -> c.d.o.server -> Re: Deleting duplicate records

Re: Deleting duplicate records

From: Chrysalis <cellis_at_iol.ie>
Date: 1997/02/27
Message-ID: <3315856F.5D64@iol.ie>#1/1

Kjell R. Christensen wrote:
>
> amit srivastava wrote:
> >
> > How can one delete all the records and leave one, if you have more than
> > 2 duplicates for certain records in a table? , using SQL.
>
> Hi,
>
> this is one way of doing it!
>
> sql> delete from 'table_name' where rowid not in (select min(rowid) from
> 'table_name' group by 'columns that form your unique index'
>
> Kjell R.

Another way which leaves the table in a more compact state (if you have space) is:
create new_table as select * from old_table [storage...]; drop old_table;
rename new_table to old_table; Received on Thu Feb 27 1997 - 00:00:00 CST

Original text of this message

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