Re: Append n Rows into a Single Row

Поиск
Список
Период
Сортировка
От Ross J. Reedstrom
Тема Re: Append n Rows into a Single Row
Дата
Msg-id 20110620170557.GC16364@rice.edu
обсуждение исходный текст
Ответ на Re: Append n Rows into a Single Row  (Samuel Gendler <sgendler@ideasculptor.com>)
Список pgsql-sql
On Sat, Jun 18, 2011 at 08:51:55PM -0700, Samuel Gendler wrote:
> Actually, you need the array_agg() function to aggregate multiple rows into
> a single array, and that is discussed on the aggregate functions page,
> here: http://www.postgresql.org/docs/9.0/static/functions-aggregate.html
> 
> You could then use one of the other array functions to manipulate that
> array.
> 
> But given that you are appending strings to each other in your example, you
> can also just use the string_agg function from that same page - assuming you
> are on 9.0.  It looks like that function isn't available before 9.0
> 

Nice blog post about this here:

http://www.postgresonline.com/journal/archives/191-stringagg.html

Ross
-- 
Ross Reedstrom, Ph.D.                                 reedstrm@rice.edu
Systems Engineer & Admin, Research Scientist        phone: 713-348-6166
Connexions                  http://cnx.org            fax: 713-348-3665
Rice University MS-375, Houston, TX 77005
GPG Key fingerprint = F023 82C8 9B0E 2CC6 0D8E  F888 D3AE 810E 88F0 BEDE


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

Предыдущее
От: Cstdenis
Дата:
Сообщение: Query to select nested comments sorted by nesting and date
Следующее
От: Andreas
Дата:
Сообщение: problem with selecting from a function