From: | Phillip Smith <phillip(dot)smith(at)weatherbeeta(dot)com(dot)au> |
---|---|
To: | henlin <henlin(at)yandex(dot)ru> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: delete non-unique |
Date: | 2007-04-25 13:57:53 |
Message-ID: | 1177509473.4706.15.camel@fukawi2.homelinux.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Similar to other suggestion:
BEGIN;
SELECT DISTINCT ON (col1) * INTO TEMP unique_rows FROM table1;
COPY unique_rows TO '/tmp/unique.sql';
TRUNCATE TABLE table1;
COPY table1 FROM '/tmp/unique.sql';
COMMIT;
On Wed, 2007-04-25 at 13:08 +0400, henlin wrote:
> i need to clean up some tables: from several equal rows keep only one
> (like `sort -u`)
>
> aaa bbb - do not delete
> aaa bbb - delete
> aaa bbb - delete
*******************Confidentiality and Privilege Notice*******************
The material contained in this message is privileged and confidential to
the addressee. If you are not the addressee indicated in this message or
responsible for delivery of the message to such person, you may not copy
or deliver this message to anyone, and you should destroy it and kindly
notify the sender by reply email.
Information in this message that does not relate to the official business
of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta.
Weatherbeeta, its employees, contractors or associates shall not be liable
for direct, indirect or consequential loss arising from transmission of this
message or any attachments
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Swierczek | 2007-04-25 14:36:43 | custom crosstab question |
Previous Message | Francois Deliege | 2007-04-25 13:29:59 | moving data from windows to linux |