Re: combine multiple row values in to one row

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: Lee Harr <missive(at)hotmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: combine multiple row values in to one row
Date: 2009-07-07 00:22:35
Message-ID: 20090707022235.6bd1e038@dawn.webthatworks.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 7 Jul 2009 01:59:35 +0430
Lee Harr <missive(at)hotmail(dot)com> wrote:

>
> Hi;
>
> I'm looking for a way to do this:

> # select idn, magic() as codes FROM tbl;
> idn | codes
> -----+------
> 1 | A
> 2 | B, C
> 3 | A, C, E
> (3 rows)
>
>
> Right now, I use plpgsql functions, but each time I do it
> I have to rewrite the function to customize it.
>
> Is there a generic way to do this? An aggregate maybe?

array_accum
http://www.postgresql.org/docs/8.2/static/xaggr.html
?

--
Ivan Sergio Borgonovo
http://www.webthatworks.it

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paul Ramsey 2009-07-07 00:26:01 Re: Out of memory error
Previous Message John Cheng 2009-07-06 23:17:16 Re: Problem search on text arrays, using the overlaps (&&) operator