return a text agreggate from a subselect

From: Louis-David Mitterrand <vindex(at)apartia(dot)org>
To: pgsql-sql(at)postgresql(dot)org
Subject: return a text agreggate from a subselect
Date: 2001-12-19 16:11:28
Message-ID: 20011219161128.GB28569@apartia.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

I am trying to convert a subselect that has several matches into one
string comprising all matches concatenated:

The subselect: (SELECT company_name FROM table)

The output I'd like: 'Company1|Company2|Company3|etc.'

Should I write a function or a new agreggate for this or is there is
simpler way?

Thanks in advance,

--
PANOPE: On dit même qu'au trône une brigue insolente
Veut placer Aricie et le sang de Pallante.
(Phèdre, J-B Racine, acte 1, scène 4)

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message David M. Richter 2001-12-19 19:11:42 queryoptimizer force index use
Previous Message Tom Lane 2001-12-19 15:11:51 Re: Stupid question on INDEXES