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: Concat field result in select query


  • From: Lennin Caro <lennin(dot)caro(at)yahoo(dot)com>
  • To: pgsql-sql(at)postgresql(dot)org, Nacef LABIDI <nacef(dot)l(at)gmail(dot)com>
  • Subject: Re: Concat field result in select query
  • Date: Fri, 22 Aug 2008 09:16:25 -0700 (PDT)
  • Message-id: <613677.80516.qm@web59503.mail.ac4.yahoo.com> <text/plain>

> Hi all,
> 
> I was wondering if there is a way to concatenate the
> results of a field in a
> select to return it as a single string.
> 
> Example :
> 
> my_field
> --------------
> 1
> 2
> 3
> 
> select concat_something(my_field) from my_table group by
> something;
> the result expected would be someting like that : 1/2/3
> (with a separator it
> would be really nice)
> 
> I hope that I am not asking for too much ;)
> 
> Thanks to all

you can use aggregate function, check for previous threads for this solution

http://www.postgresql.org/docs/8.3/static/sql-createaggregate.html


      




Home | Main Index | Thread Index

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