Duplicated records

From: lucas(at)presserv(dot)org
To: pgsql-sql(at)postgresql(dot)org
Subject: Duplicated records
Date: 2005-05-24 20:59:31
Message-ID: 20050524175931.4dp41vy7v10c4wc4@www.presserv.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message PFC 2005-05-24 21:26:04 Re: Duplicated records
Previous Message J.Bougani 2005-05-24 20:25:54 Geschäftliches Angebot