From: | Mike Mascari <mascarm(at)mascari(dot)com> |
---|---|
To: | Matthias Nagl <pg(at)mnagl(dot)de> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Combining several rows |
Date: | 2004-05-24 13:10:15 |
Message-ID: | 40B1F437.4000806@mascari.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Liza | 2004-05-24 13:16:11 | Re: PG_HBA.conf still keeps complaining. I've done all I could imagine. |
Previous Message | Matthias Nagl | 2004-05-24 12:39:55 | Combining several rows |