| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.tools -> Re: how can I delete duplicate rows?
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
![]() |
![]() |