From: Ross J. Reedstrom <reedstrm@rice.edu>
To: Samuel Gendler <sgendler@ideasculptor.com>
Cc: Rob Sargent <robjsargent@gmail.com>
Cc: Tripura <k_tripura@hotmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Append n Rows into a Single Row
Date: Mon, 20 Jun 2011 12:05:57 -0500
Message-ID: <20110620170557.GC16364@rice.edu> (raw)
In-Reply-To: <BANLkTim1GPLFqiTrXW695Hevvj4Bz8Ch=g@mail.gmail.com>
References: <1308356423557-4500306.post@n5.nabble.com>
<4DFD6E22.1090700@gmail.com>
<BANLkTim1GPLFqiTrXW695Hevvj4Bz8Ch=g@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: reedstrm@rice.edu, sgendler@ideasculptor.com, robjsargent@gmail.com, k_tripura@hotmail.com
Subject: Re: Append n Rows into a Single Row
In-Reply-To: <20110620170557.GC16364@rice.edu>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox