Multiple rows into one row

Поиск
Список
Период
Сортировка
От Raimon
Тема Multiple rows into one row
Дата
Msg-id EFEC7208-A1D0-48AD-83EA-94C968DA6C66@montx.com
обсуждение исходный текст
Ответ на using column alias to make operations  (Raimon Fernandez <coder@montx.com>)
Ответы Re: Multiple rows into one row  ("Mike Ellsworth" <younicycle@gmail.com>)
Re: Multiple rows into one row  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Список pgsql-novice
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, ...

thanks,


raimon



В списке pgsql-novice по дате отправления:

Предыдущее
От: "Robert M. Bernabe"
Дата:
Сообщение: Re: Group Roles are now Login Roles in pgAdmin?
Следующее
От: "Mike Ellsworth"
Дата:
Сообщение: Re: Multiple rows into one row