Subject Re: [firebird-support] Problem in Nested aggregate functions -FireBird1.5
Author Alexandre Benson Smith
suresh.dodda@... wrote:
> I am using following query.
>
> I am getting the error: Nested aggregate functions are not allowed
>
> Can any one suggest how to use nested aggregate functions?
>
>
>
> SELECT MAX (COUNT (usr_id)) FROM usr_det GROUP BY usr_id;
>
>
Hi Suresh,


In FB 1.5 you could create a view with the counts and then select the
MAX from there.

or

select first 1 COUNT (usr_id), usr_id FROM usr_det GROUP BY usr_id order by 1 desc;



In FB 2.0 you could use in-line views.

see you !

--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br