Search Postgresql Archives

Re: Combining several rows

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

 



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


---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster

[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