How fetch multiple rows into one text-field?

From: Andreas <maps(dot)on(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: How fetch multiple rows into one text-field?
Date: 2009-07-31 20:09:46
Message-ID: 4A734F8A.906@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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.

There is a log with a single record per event.
The log is like this (log_id, case_id, log_date, log_category, log_notes)
I need a date-ordered list of log-date, -category, -notes of all
log-events of the same case-id like
log_date || ' ' || log_category || ' : ' || log_nots
e.g.
20.07.2009 Category 17 : utterly noteworthy notes
21.07.2009 Category 42 : lots more
22.07.2009 Category 17 : still more drivel

The report consists of a couple of case-infos and should look like
case_id, case_name, case_all_log_events

Is there a way to do this?

regards
andreas

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Joshua Tolley 2009-07-31 23:29:35 Re: How fetch multiple rows into one text-field?
Previous Message Jasmin Dizdarevic 2009-07-31 18:52:16 Re: on error resume next