Re: merge result sets

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: simon <simon(dot)litwan(at)wyona(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: merge result sets
Date: 2006-06-20 20:34:52
Message-ID: 20060620203452.GB21987@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jun 20, 2006 at 12:06:24 +0200,
simon <simon(dot)litwan(at)wyona(dot)com> wrote:
> hi all
>
> i'm using postgres 7.3
>
> my problem is i want to build a helper table:
>
> UPDATE studienmodul_summary
> SET kategorie = (SELECT kategorie_bezeichnung
>
> if the SELECT gives back just one result row, everthing is easy. my
> problem is, there is sometimes more than one result row.
>
> is there a way to concatenate all result rows and insert them in one
> field?

Yes. You can have the subselect call a custom aggregate function that does
this for you. Sample code for doing this has been posted on the list
multiple times and you should be able to find it in the archives.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2006-06-20 20:41:48 Re: help with error message from perl Pg
Previous Message Chander Ganesan 2006-06-20 20:32:23 Re: Start up question about triggers