Re: Concatenation through SQL

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Concatenation through SQL
Date: 2007-12-21 10:58:13
Message-ID: 20071221105813.GA18247@KanotixBox
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Philippe Lang <philippe(dot)lang(at)attiksystem(dot)ch> schrieb:

2 ways:

* You can use something like this:

test=*# select * from a;
id | val
----+-----
1 | foo
2 | bar
(2 rows)

test=*# select array_to_string(array(select val from a), ', ');
array_to_string
-----------------
foo, bar
(1 row)

* comma-aggregate, see
http://www.zigo.dhs.org/postgresql/#comma_aggregate

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknow)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Pavel Stehule 2007-12-21 11:07:17 Re: Concatenation through SQL
Previous Message Philippe Lang 2007-12-21 10:33:40 Concatenation through SQL