Re: Multiple rows into one row

Поиск
Список
Период
Сортировка
От Mike Ellsworth
Тема Re: Multiple rows into one row
Дата
Msg-id 219951fd0802020754r28b0cf3bpd31e378dc1c38ef@mail.gmail.com
обсуждение исходный текст
Ответ на Multiple rows into one row  (Raimon <coder@montx.com>)
Ответы Re: Multiple rows into one row  (Raimon <coder@montx.com>)
Список 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 по дате отправления:

Предыдущее
От: Raimon
Дата:
Сообщение: Multiple rows into one row
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Multiple rows into one row