Search Postgresql Archives

Combining several rows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@postgresql.org so that your
      message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux