Combining several rows

Поиск
Список
Период
Сортировка
От Matthias Nagl
Тема Combining several rows
Дата
Msg-id 200405241439.55764.pg@mnagl.de
обсуждение исходный текст
Ответы Re: Combining several rows  (Mike Mascari <mascarm@mascari.com>)
Re: Combining several rows  (Holger Klawitter <lists@klawitter.de>)
Re: Combining several rows  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Combining several rows  (Greg Stark <gsstark@mit.edu>)
Список pgsql-general
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

It should work for any number of rows. I would like to Insert the returned
String (with a comma separated list of all name-fields in the test-table) in
the main-query ( SELECT (whatever is a solution) AS name, other, fields FROM
tables...).

Thanks in advance

Matthias Nagl

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

Предыдущее
От: Brendan Jurd
Дата:
Сообщение: PL/pgSQL: FOUND not set by EXECUTE?
Следующее
От: Mike Mascari
Дата:
Сообщение: Re: Combining several rows