Subject Re: [firebird-support] grouping with an "as" field
Author Nando Dessena
Hello,

l> select distinct(fielda),count(*) as amount from table group by fielda
l> order by amount desc;

l> this does not work

l> but:

l> select distinct(fielda),count(*) as amount from table group by fielda
l> order by count(*) desc;
l> does

l> how would i order by the "as" defined field?

if your question is how can you make work the variant that doesn't,
then the answer is you can't, currently.
You have two options, afaik: "order by count(*)" or "order by 2"
Otherwise I may have misread your request.

Ciao
--
Nando Dessena
mailto:nandod@...
======================================================
I support Firebird, I am a Firebird Foundation member!
Join today at http://www.firebirdsql.org/ff/foundation
======================================================