Combining several rows - Mailing list pgsql-general

From Matthias Nagl
Subject Combining several rows
Date
Msg-id 200405241439.55764.pg@mnagl.de
Whole thread Raw
Responses Re: Combining several rows
Re: Combining several rows
Re: Combining several rows
Re: Combining several rows
List 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 by date:

Previous
From: Brendan Jurd
Date:
Subject: PL/pgSQL: FOUND not set by EXECUTE?
Next
From: Mike Mascari
Date:
Subject: Re: Combining several rows