Re: Sorting CSV string and removing Duplicates

Поиск
Список
Период
Сортировка
От dinesh kumar
Тема Re: Sorting CSV string and removing Duplicates
Дата
Msg-id CALnrH7oVCh4+1hbtZcjoaRniwJ51XMNC-et8MKr3GjTbqX8uFw@mail.gmail.com
обсуждение исходный текст
Ответ на Sorting CSV string and removing Duplicates  (Alex Magnum <magnum11200@gmail.com>)
Ответы Re: Sorting CSV string and removing Duplicates  (dinesh kumar <dineshkumar02@gmail.com>)
Список pgsql-general
On Mon, Jul 27, 2015 at 12:53 PM, Alex Magnum <magnum11200@gmail.com> wrote:
Hello,

I have a csv string in a text field that is unsorted and contains duplicates.
Is there a simple way to remove these and sort the string.

E.g 
2,18,20,23,1,27,1,2,8,16,17,18,20,22,23,27 

i tried string to array and unique but that did not work...
Any suggestions on how to do this without writing a function?

Any help is appreciated.


Are you looking for this.

postgres=# SELECT unnest(string_to_array(t, ',')) from test group by 1;
 unnest
--------
 2
 18
 8
 20
 22
 16
 27
 17
 23
 1
(10 rows)

 
Regards,
Dinesh

Thanks
A

В списке pgsql-general по дате отправления:

Предыдущее
От: Alex Magnum
Дата:
Сообщение: Sorting CSV string and removing Duplicates
Следующее
От: Yves Dorfsman
Дата:
Сообщение: Re: Sorting CSV string and removing Duplicates