From: greg@turnstep.com
To: pgsql-sql@postgresql.org
Subject: Re: How to delete duplicate record
Date: Mon, 10 Feb 2003 14:44:10 -0000
Message-ID: <b1761f04edab6a7b6d95e10f1b696b49@biglumber.com> (raw)
In-Reply-To: <20030209231117.H93398-100000@megazone23.bigpanda.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Abdul Wahab Dahalan:
>> Here I've 7 duplicated records and tried to delete 6 from them.
Stephan Szabo:
> delete from biztypes where ctid in (select ctid from biztypes where
> bizid='B116' limit 6);
A more general form of the "delete all but one" is:
DELETE FROM biztypes WHERE ctid !=
(SELECT ctid FROM biztypes WHERE bizid='B116' LIMIT 1);
You can also usually use the oid column instead of the ctid column.
System columns explained:
http://www.gtsm.com/cgi/psearch?page=ddl-system-columns.html;q=ctid;c=0
- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200302100934
-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html
iD8DBQE+R7oUvJuQZxSWSsgRAloaAJ9AkNjjYvCuOB8wanR8RoouEmU6eACg5YVX
3R+q3GDK5Pblu7L7z3TIEnE=
=qM8Y
-----END PGP SIGNATURE-----
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: greg@turnstep.com
Subject: Re: How to delete duplicate record
In-Reply-To: <b1761f04edab6a7b6d95e10f1b696b49@biglumber.com>
* 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