From: Volkan YAZICI <yazicivo@ttnet.net.tr>
To: Everton Luís Berz <everton.berz@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Sorting aggregate column contents
Date: Wed, 3 May 2006 00:13:40 +0300
Message-ID: <20060502211340.GA188@alamut> (raw)
In-Reply-To: <4457C86F.8040303@gmail.com>
References: <4457C86F.8040303@gmail.com>
On May 02 06:00, Everton Luís Berz wrote:
> Is it possible to sort the content of an aggregate text column?
>
> Query:
> select s.name, ag_concat(c.name) from state s
> inner join city c on (c.idstate = s.idstate)
> group by s.name
> order by s.name;
IMHO, you can receive results ordered by using a subselect:
SELECT T.s_name, ag_concat(T.c_name)
FROM (SELECT s.name, c.name
FROM state AS s
INNER JOIN city AS c ON (c.idstate = s.idstate)
ORDER BY s.name, c.name) AS T (s_name, c_name)
GROUP BY T.s_name;
Regards.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: yazicivo@ttnet.net.tr, everton.berz@gmail.com
Subject: Re: Sorting aggregate column contents
In-Reply-To: <20060502211340.GA188@alamut>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox