From: Tomasz Myrta <jasiek@klaster.net>
To: Objectz <objectz@postmark.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: String aggregate function
Date: Mon, 17 Mar 2003 10:16:10 +0100
Message-ID: <3E75925A.5000907@klaster.net> (raw)
References: <000301c2ec5b$6380ce00$aea067d4@eg1opwxp107>
Objectz wrote:
> Hi all,
>
> I want to make an aggregate function that concatenates strings from a
> certain column into one cell in a group by clause.
> For example I have the following table :
>
> Type Text
> =================
> 1 text1
> 2 text2
> 1 text3
> 3 text4
> 2 text5
>
> I need a query that group by type and concats the text columns to
> produce something like the following :
>
> 1 text1, text3
> 2 text2, text5
> 3 text4
>
> I am aware that this can be done through recursive joins but this is too
> complicated and heavy.
>
> Any suggestions?
>
> Regards
Look at this site (Aggregate Functions):
http://www.brasileiro.net:8080/postgres/cookbook/
Regards,
Tomasz Myrta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jasiek@klaster.net, objectz@postmark.net
Subject: Re: String aggregate function
In-Reply-To: <3E75925A.5000907@klaster.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox