Re: Combining several rows

Поиск
Список
Период
Сортировка
Искать
От
Mike Mascari
Тема
Re: Combining several rows
Дата
в 10:10:45
Msg-id
40B1F437.4000806@mascari.com
Ответ на
Combining several rows (Matthias Nagl)
Список
Дерево обсуждения
Combining several rows Matthias Nagl <pg@mnagl.de>
Re: Combining several rows Tom Lane <tgl@sss.pgh.pa.us>
Re: Combining several rows Holger Klawitter <lists@klawitter.de>
Re: Combining several rows [solved] Matthias Nagl <pg@mnagl.de>
Re: Combining several rows Mike Mascari <mascarm@mascari.com>
Re: Combining several rows Greg Stark <gsstark@mit.edu>
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

В списке pgsql-general по дате отправления
От: Matthias Nagl
Дата:
Сообщение: Combining several rows
От: Holger Klawitter
Дата:
Сообщение: Re: Combining several rows
FAQ