Re: Multiple rows into one row - Mailing list pgsql-novice

From Mike Ellsworth
Subject Re: Multiple rows into one row
Date
Msg-id 219951fd0802020754r28b0cf3bpd31e378dc1c38ef@mail.gmail.com
Whole thread Raw
In response to Multiple rows into one row  (Raimon <coder@montx.com>)
Responses Re: Multiple rows into one row  (Raimon <coder@montx.com>)
List pgsql-novice
On Feb 2, 2008 10:13 AM, Raimon <coder@montx.com> wrote:
> Hello,
>
> I can't find any reference in PostgreSQL documentation, if this is
> possible:
>
> I want to have some rows in one column, with the values separated for
> example by a comma.
>
> SELECT name FROM animals WHERE customer_id = '5'
>
> - cat
> - dog
> - turtle
>
> I would like to have this like this:
>
> - cat, dog, turtle
>
>
> So I could issue a SELECT like this:
>
> SELECT customer.name, (SELECT name FROM animals WHERE customer_id =
> customer.id) AS animals FROM customer
>
> name    animals
> ------- -----------
> Peter   dog,cat
> Lisa            turtle
> Anthony bird,elephant
>
> I could find info about PIVOT and some other extra functionalities
> from other databases like Oracle, SQL server, ...
>

I think, here: http://www.postgresql.org/docs/8.3/static/tablefunc.html

pgsql-novice by date:

Previous
From: Raimon
Date:
Subject: Multiple rows into one row
Next
From: "A. Kretschmer"
Date:
Subject: Re: Multiple rows into one row