pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PFC <lists@boutiquenumerique.com>
To: lucas@presserv.org
To: pgsql-sql@postgresql.org
Subject: Re: Duplicated records
Date: Tue, 24 May 2005 23:26:04 +0200
Message-ID: <op.srattqosth1vuj@localhost> (raw)
In-Reply-To: <20050524175931.4dp41vy7v10c4wc4@www.presserv.org>
References: <20050524175931.4dp41vy7v10c4wc4@www.presserv.org>


> 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 !



view thread (8+ messages)  latest in thread

Message-ID: <op.srattqosth1vuj@localhost>
Permalink:  ../op.srattqosth1vuj@localhost/
Also on:    postgresql.org/message-id/op.srattqosth1vuj@localhost

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: lists@boutiquenumerique.com, lucas@presserv.org
  Subject: Re: Duplicated records
  In-Reply-To: <op.srattqosth1vuj@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox