Subject Re: [firebird-support] Nested aggregate functions
Author Vlad Horsun
> This statement is not (returns 'Nested aggregate functions are not
> allowed'):
>
> SELECT
> SUM(t1.COL1 - (SELECT SUM(t2.COL1) FROM TABLE2 t2 WHERE t2.COL2 = ?))
> FROM
> TABLE1 t1
>
> In both cases the SELECT on TABLE2 is standalone, and does not require
> any nested aggregation on the original stream.

SELECT SUM(D1.RDB$RELATION_ID -
(SELECT SUM(D2.RDB$RELATION_ID)
FROM RDB$DATABASE D2))
FROM RDB$DATABASE D1

worked fine even in FB 1.5.2

Regards,
Vlad