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

Home -> Community -> Usenet -> c.d.o.tools -> Re: how can I delete duplicate rows?

Re: how can I delete duplicate rows?

From: Steve <steve.hollings_at_ecrossnet.com>
Date: Wed, 23 May 2001 14:04:20 +0100
Message-ID: <3b0bb58f$0$12248$ed9e5944@reading.news.pipex.net>

Or:

    DELETE FROM Table a
    WHERE a.ROWID != (SELECT MIN(b.ROWID) FROM Table b WHERE b.id = a.id)

"Daniel A. Morgan" <dmorgan_at_exesolutions.com> wrote in message news:3B0B51FF.BB93D48F_at_exesolutions.com...
> Mike Moore wrote:
>
> > How can I delete duplicate rows from a table and only leave
> > one in the table? Lets assume that all of the columns have
> > identical values.
> >
> > Thanks,
> > Mike
>
> There are many solutions. Here's one of them.
>
> CREATE TABLE xyz AS
> SELECT distinct field1, field2, field3
> FROM mytable;
>
> TRUNCATE TABLE mytable;
>
> INSERT INTO mytable
> SELECT *
> FROM xyz;
>
> Daniel A. Morgan
>
Received on Wed May 23 2001 - 08:04:20 CDT

Original text of this message

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