Re: How fetch multiple rows into one text-field?

From: Joshua Tolley <eggyknap(at)gmail(dot)com>
To: Andreas <maps(dot)on(at)gmx(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: How fetch multiple rows into one text-field?
Date: 2009-07-31 23:29:35
Message-ID: 20090731232935.GZ4385@eddie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, Jul 31, 2009 at 10:09:46PM +0200, Andreas wrote:
> Hi,
>
> how can I fetch multiple rows into one text-field?
> I need the contents of some log-infos condensed into a single text to
> show in a report.

It sounds like you might want something like this:

SELECT ... array_to_string(array_accum(log_notes, '<some delimiter>')) FROM...

You might need to add array_accum manually; before 8.4 it wasn't built in.
See http://www.postgresql.org/docs/8.3/static/xaggr.html

--
Joshua Tolley / eggyknap
End Point Corporation
http://www.endpoint.com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message dino 2009-08-03 09:02:59 Activity count problem
Previous Message Andreas 2009-07-31 20:09:46 How fetch multiple rows into one text-field?