Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

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: Fri, 21 Dec 2007 11:58:13 +0100
  • Message-id: <20071221105813.GA18247@KanotixBox> <text/plain>

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°



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group