Re: Combining several rows - Mailing list pgsql-general

From Mike Mascari
Subject Re: Combining several rows
Date
Msg-id 40B1F437.4000806@mascari.com
Whole thread Raw
In response to Combining several rows  (Matthias Nagl <pg@mnagl.de>)
List pgsql-general
Matthias Nagl wrote:
> Hello List!
>
> I would like to combine the contents of several rows of a subquery. After
> several hours of search in the documentation and the internet I didn'T find a
> solution and hope anyone can help. My problem:
>
> Let's say I've got a table in the following form:
>
> SELECT * FROM test;
>
> id  |  name
> -----------
>  1  |  abc
>  2  |  def
>  3  |  ghi
>
> For a table like this I am looking for a query that returns a result that
> looks this way:
>
>     name
> -------------
> abc, def, ghi

Joe Conway's crosstab() function in the 'tablefunc' contrib
directory of the source tree is probably what you want. If you've
installed by RPM, the postgresql-contrib package will have installed
the SQL script to initialize the function in
/usr/share/pgsql/contrib/tablefunc.sql.

HTH,

Mike Mascari


pgsql-general by date:

Previous
From: Matthias Nagl
Date:
Subject: Combining several rows
Next
From: Holger Klawitter
Date:
Subject: Re: Combining several rows