Re: Sorting items in aggregate function

Поиск
Список
Период
Сортировка
От Volkan YAZICI
Тема Re: Sorting items in aggregate function
Дата
Msg-id 20060912182439.GB1373@alamut
обсуждение исходный текст
Ответ на Sorting items in aggregate function  (Steven Murdoch <psql+Steven.Murdoch@cl.cam.ac.uk>)
Список pgsql-sql
On Sep 12 04:46, Steven Murdoch wrote:
> I would like to concatenate sorted strings in an aggregate function. I
> found a way to do it without sorting[1], but not with.

If the array elements will be made of integers, then you can use sort()
procedure comes with intarray contrib module. For instance,
 SELECT concat(T.sorted_arr)   FROM (SELECT sort(arr) FROM tbl) AS T (sorted_arr);

If related column will also include text values, you can create a
suitable sort() procedure for text[] type and use it instead.


Regards.


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

Предыдущее
От: "Aaron Bono"
Дата:
Сообщение: Re: on connect/on disconnect
Следующее
От: "Aaron Bono"
Дата:
Сообщение: Re: Two optimization questions