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: Daniel A. Morgan <dmorgan_at_exesolutions.com>
Date: Tue, 22 May 2001 23:00:31 -0700
Message-ID: <3B0B51FF.BB93D48F@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 - 01:00:31 CDT

Original text of this message

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