Search Postgresql Archives

Re: Ordering of records in group by not possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi:

> You could order by "column 2" if you want to order on the
> results on 
> your aggregate:
> 	Select a, aggregate(b)
> 	from c
> 	group by a
> 	order by a,2
> 

another alternative is :

   select a , aggregrate(b) as <alias>
   from c
   group by a
   order by a, <alias>

e.g.
   
   select a,sum(b) as sum_b
   from c
   group by a
   order by a, sum_b

ludwig lim

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux