Re: Sorting CSV string and removing Duplicates

Поиск
Список
Период
Сортировка
Искать
От
Chris Mair
Тема
Re: Sorting CSV string and removing Duplicates
Дата
Msg-id
35e29ba3c267816a0b78ac4f48bc357d@smtp.hushmail.com
Ответ на
Список
Дерево обсуждения
Sorting CSV string and removing Duplicates Alex Magnum <magnum11200@gmail.com>
Re: Sorting CSV string and removing Duplicates Chris Mair <chris@1006.org>
Re: Sorting CSV string and removing Duplicates Yves Dorfsman <yves@zioup.com>
Re: Sorting CSV string and removing Duplicates dinesh kumar <dineshkumar02@gmail.com>
Re: Sorting CSV string and removing Duplicates dinesh kumar <dineshkumar02@gmail.com>
Re: Sorting CSV string and removing Duplicates Alex Magnum <magnum11200@gmail.com>
> 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.
> 
> Thanks
> A


chris=# SELECT distinct x::int from
unnest(string_to_array('2,18,20,23,1,27,1,2,8,16,17,18,20,22,23,27',
',')) x order by x::int;

 x
----
  1
  2
  8
 16
 17
 18
 20
 22
 23
 27
(10 rows)

Bye,
Chris.



В списке pgsql-general по дате отправления
От: Yves Dorfsman
Дата:
От: dinesh kumar
Дата:
FAQ