pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: lucas@presserv.org
To: pgsql-sql@postgresql.org
Subject: Duplicated records
Date: Tue, 24 May 2005 17:59:31 -0300
Message-ID: <20050524175931.4dp41vy7v10c4wc4@www.presserv.org> (raw)

Hi.
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.

 select * from table1; --id may be primary key
 - Table1 -
 id | field 2
 0  | 'aaa'
 1  | 'bbb'
 2  | 'ccc'
 0  | 'aaa'  <<== The data is duplicated
 1  | 'bbb'
 2  | 'ccc'
 0  | 'aaa'
 1  | 'bbb'
 2  | 'ccc'
Is there a way to delete the duplicated data without build another table with
constraints and copy those data to the new table?
Something like "delete from table1 where ...???"

Thanks,
Lucas



view thread (8+ messages)  latest in thread

Message-ID: <20050524175931.4dp41vy7v10c4wc4@www.presserv.org>
Permalink:  ../20050524175931.4dp41vy7v10c4wc4@www.presserv.org/
Also on:    postgresql.org/message-id/20050524175931.4dp41vy7v10c4wc4@www.presserv.org

 · 

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: lucas@presserv.org
  Subject: Re: Duplicated records
  In-Reply-To: <20050524175931.4dp41vy7v10c4wc4@www.presserv.org>

* 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