Re: How to remove duplicate lines but save one of the lines? - Mailing list pgsql-general

From Said Ramirez
Subject Re: How to remove duplicate lines but save one of the lines?
Date
Msg-id 4884AE4E.7050206@vonage.com
Whole thread Raw
In response to How to remove duplicate lines but save one of the lines?  ("A B" <gentosaker@gmail.com>)
Responses Re: How to remove duplicate lines but save one of the lines?
List pgsql-general
There is probably a more elegant way of doing it, but  a simple way of
doing it ( depending on the size of the table ) could be:

begin;

insert into foo select distinct * from orig_table;
delete from orig_table;
insert into orig_table select * from foo;

commit;

   -Said

A B wrote:
> I have a table with rows like this
> A 1
> A 1
> B 3
> B 3
> C 44
> C 44
> and so on.
>
> and I want it to be
> A 1
> B 3
> C 44
>
> so how can I remove the all the duplicate lines but one?
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>


pgsql-general by date:

Previous
From: Raymond O'Donnell
Date:
Subject: Re: How to remove duplicate lines but save one of the lines?
Next
From: "Francisco Reyes"
Date:
Subject: Re: How to remove duplicate lines but save one of the lines?