Re: Sorting aggregate column contents - Mailing list pgsql-sql

From Volkan YAZICI
Subject Re: Sorting aggregate column contents
Date
Msg-id 20060502211340.GA188@alamut
Whole thread Raw
In response to Sorting aggregate column contents  (Everton Luís Berz <everton.berz@gmail.com>)
Responses Re: Sorting aggregate column contents
Re: Sorting aggregate column contents
List pgsql-sql
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.


pgsql-sql by date:

Previous
From: Everton Luís Berz
Date:
Subject: Sorting aggregate column contents
Next
From: Bruno Wolff III
Date:
Subject: Re: Sorting aggregate column contents