Re: Concatenate results of a single column query

Поиск
Список
Период
Сортировка
От Christoph Haller
Тема Re: Concatenate results of a single column query
Дата
Msg-id 200404191315.PAA09557@rodos
обсуждение исходный текст
Ответ на Re: Concatenate results of a single column query  (Greg Stark <gsstark@mit.edu>)
Ответы Re: Concatenate results of a single column query
Re: Concatenate results of a single column query
Список pgsql-sql
> 
> 
> Marco Lazzeri <marcomail@noze.it> writes:
> 
> > SELECT
> >   p.name, ARRAY(SELECT nicknames FROM people WHERE people.id = p.id)
> > FROM people AS p
> 
> > Any suggestions?
> 
> Something like:
> 
> db=> create aggregate array_aggregate (basetype = integer, sfunc = array_append, stype = integer[], initcond =
'{}');
> CREATE AGGREGATE
> 
> db=> select array_aggregate(id) from tab;
>                                                                       array_aggregate
                                     
 
>
------------------------------------------------------------------------------------------------------------------------------------------------------------
>
{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,28,29,30,31,32,33,34,36,37,38,39,40,41,42,43,27,26,44,45,46,47,48,49,50,51,52,53,54,35}
> (1 row)
> 
> -- 
> greg
> 
> 
Interesting feature, but I cannot find function array_append: 
ERROR:  AggregateCreate: function array_append(integer[], integer) does not exist

TIA 

Regards, Christoph 



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

Предыдущее
От: Gary Stainburn
Дата:
Сообщение: three-way join
Следующее
От: Greg Stark
Дата:
Сообщение: Re: Concatenate results of a single column query