Re: group by/order by problem
Date: Sun, 23 May 2010 08:54:42 -0700 (PDT)
On May 23, 6:45 pm, Ken Quirici <kquir..._at_yahoo.com> wrote:
> The following query:
> sum(hp) thp
> from b_data
> where hp = 1
> group by player
> order by thp
> does not sort the results either by player or thp.
> Is there some logical reason for this, or is order by only
> designed to sort group by's by the group by column?
> Basically, how can I get it to sort by thp?
> Any help MUCH appreciated.
> Ken Quirici
select player, thp
from (select player, sum(hp) thp
from b_data where hp = 1 group by player)
order by thp;
To order by thp Oracle needs to "materialize" the inner view, so you need to give it a chance to do so.
Vladimir M. Zakharychev
N-Networks, makers of Dynamic PSP(tm) http://www.dynamicpsp.com Received on Sun May 23 2010 - 10:54:42 CDT