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: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Wed, 23 May 2001 09:36:22 -0400
Message-ID: <s4fngt0raqmt1uuv1ca2eqtnm7hb5uuuo9@4ax.com>

A copy of this was sent to "Mike Moore" <hicamel_at_mail.home.com> (if that email address didn't require changing) On Wed, 23 May 2001 01:22:00 GMT, you 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
>

delete from t t1
where rowid <> ( select min(rowid)

                   from t t2 
                  where t2.c1 = t1.c1 
                    and t2.c2 = t1.c2  
                    and .... )

/
--
Thomas Kyte (tkyte_at_us.oracle.com) Oracle Service Industries
Howtos and such: http://asktom.oracle.com/
Oracle Magazine: http://www.oracle.com/oramag
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Wed May 23 2001 - 08:36:22 CDT

Original text of this message

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