Re: Append n Rows into a Single Row - Mailing list pgsql-sql

From Ross J. Reedstrom
Subject Re: Append n Rows into a Single Row
Date
Msg-id 20110620170557.GC16364@rice.edu
Whole thread Raw
In response to Re: Append n Rows into a Single Row  (Samuel Gendler <sgendler@ideasculptor.com>)
List 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 by date:

Previous
From: Cstdenis
Date:
Subject: Query to select nested comments sorted by nesting and date
Next
From: Andreas
Date:
Subject: problem with selecting from a function