Re: delete non-unique - Mailing list pgsql-novice

From Phillip Smith
Subject Re: delete non-unique
Date
Msg-id 1177509473.4706.15.camel@fukawi2.homelinux.net
Whole thread Raw
In response to delete non-unique  (henlin <henlin@yandex.ru>)
List 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

pgsql-novice by date:

Previous
From: Frank Bax
Date:
Subject: Re: Comparison of dates
Next
From: Francois Deliege
Date:
Subject: moving data from windows to linux