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