From: Markus Bertheau <twanger@bluetwanger.de>
To: Peter T. Brown <peter@memeticsystems.com>
Cc: postgres sql list <pgsql-sql@postgresql.org>
Subject: Re: contracting tables
Date: 30 Nov 2001 08:53:28 +0100
Message-ID: <1007106809.1107.11.camel@entwicklung01.cenes.de> (raw)
In-Reply-To: <00e001c17930$aa8af8b0$7d00000a@PETER>
References: <00e001c17930$aa8af8b0$7d00000a@PETER>
On Fri, 2001-11-30 at 00:50, Peter T. Brown wrote:
> I have a table with many records, some of which are duplicates (there is no
> unique constraints). How can I contract this table to remove any of these
> duplicate records? Like when using GROUP BY in a select statement, except
> that I want to just remove the extra entries from this table directly... Any
> ideas?
If I understood you right, one problem is to identify only one row of a
duplicate. There is a 'hidden' field oid in every table that is unique.
It goes like this:
select oid, * from <yourtable>
So you could delete the rows by oid:
delete from <yourtable> where oid = <oid>
HTH
Markus Bertheau
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: twanger@bluetwanger.de, peter@memeticsystems.com
Subject: Re: contracting tables
In-Reply-To: <1007106809.1107.11.camel@entwicklung01.cenes.de>
* 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