Re: Multiple rows into one row
От | A. Kretschmer |
---|---|
Тема | Re: Multiple rows into one row |
Дата | |
Msg-id | 20080202160436.GA32408@a-kretschmer.de обсуждение исходный текст |
Ответ на | Multiple rows into one row (Raimon <coder@montx.com>) |
Ответы |
Re: Multiple rows into one row
|
Список | pgsql-novice |
am Sat, dem 02.02.2008, um 16:13:20 +0100 mailte Raimon folgendes: > 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 test=*# select * from animals ; id | name ----+-------- 5 | cat 5 | dog 5 | turtle (3 rows) test=*# select array_to_string(array(select name from animals where id=5), ', '); array_to_string ------------------ cat, dog, turtle HTH, Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
В списке pgsql-novice по дате отправления: