Re: How to remove duplicate lines but save one of the lines?

Поиск
Список
Период
Сортировка
От Said Ramirez
Тема Re: How to remove duplicate lines but save one of the lines?
Дата
Msg-id 4884AE4E.7050206@vonage.com
обсуждение исходный текст
Ответ на How to remove duplicate lines but save one of the lines?  ("A B" <gentosaker@gmail.com>)
Ответы Re: How to remove duplicate lines but save one of the lines?  ("A B" <gentosaker@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Raymond O'Donnell
Дата:
Сообщение: Re: How to remove duplicate lines but save one of the lines?
Следующее
От: "Francisco Reyes"
Дата:
Сообщение: Re: How to remove duplicate lines but save one of the lines?