Re: Duplicated records

From: PFC <lists(at)boutiquenumerique(dot)com>
To: lucas(at)presserv(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: Duplicated records
Date: 2005-05-24 21:26:04
Message-ID: op.srattqosth1vuj@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


> How can I delete the duplicated records with "DELETE FROM TABLE WHERE..."
> clause??
> The problem is becouse I have imported data from Dbase (dbf) file, and
> this
> function have not built the Constraint (unique, primary key, ...), and
> this
> function is usually executed.

If you have no primary key how can you reference a record in order to
delete it ?
I'd say use a temporary table...
If you have complete row dupes (ie. the entire row is duplicated) use
SELECT * FROM table GROUP BY *
(or select distinct)

If only the primary key is duplicated but other fields change, then you
have to decide which one you wanna keep !

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas F. O'Connell 2005-05-24 22:07:19 Re: DROP IF ...
Previous Message lucas 2005-05-24 20:59:31 Duplicated records