X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F2D459DCC15 for ; Thu, 9 Feb 2006 05:52:59 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02094-01 for ; Thu, 9 Feb 2006 05:53:00 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by postgresql.org (Postfix) with ESMTP id CD6AD9DCAA1 for ; Thu, 9 Feb 2006 05:52:56 -0400 (AST) Received: from [194.25.154.138] (helo=webserv.wug.de) by mrelayeu.kundenserver.de (node=mrelayeu0) with ESMTP (Nemesis), id 0MKwh2-1F78Tx1tJg-0000if; Thu, 09 Feb 2006 10:52:58 +0100 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1F78Tw-0002ED-00 for pgsql-sql@postgresql.org; Thu, 09 Feb 2006 10:52:56 +0100 Date: Thu, 9 Feb 2006 10:52:56 +0100 From: "A. Kretschmer" To: pgsql-sql@postgresql.org Subject: Re: Concatenate strings using GROUP BY Message-ID: <20060209095256.GD2458@webserv.wug-glas.de> Mail-Followup-To: "A. Kretschmer" , pgsql-sql@postgresql.org References: <6C0CF58A187DA5479245E0830AF84F42143B77@poweredge.attiksystem.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6C0CF58A187DA5479245E0830AF84F42143B77@poweredge.attiksystem.ch> X-DEST: 208 X-OS: Linux - weil ich es mir Wert bin! X-Info: registrierter Linux-User 97922 http://counter.li.org User-Agent: mutt-ng 1.5.9i (Linux) X-Provags-ID: kundenserver.de abuse@kundenserver.de login:51ea9561fc3f6d9539a2acd743e4748c X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.524 required=5 tests=[AWL=0.524] X-Spam-Score: 0.524 X-Spam-Level: X-Archive-Number: 200602/97 X-Sequence-Number: 24107 am 09.02.2006, um 10:35:03 +0100 mailte Philippe Lang folgendes: > id fk str > --------------- > 1 1 a > 2 1 b > 3 2 c > > Is there a pure SQL way of contactenating str values into a single string, > and get instead: > > id fk str > --------------- > 1 1 a/b > 2 12 c > > I was thinking of something like: > > SELECT id, fk, CONCAT(str || '/') > FROM FOO > GROUP BY fk > > Do we have to use PL/PGSQL for that? Yes, you need a new aggregate function. http://www.postgresql.org/docs/8.0/interactive/xaggr.html HTH, Andreas -- Andreas Kretschmer (Kontakt: siehe Header) Heynitz: 035242/47215, D1: 0160/7141639 GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net === Schollglas Unternehmensgruppe ===