Subject Aggregate function with CASE and GROUP BY clauses
Author Roberto Freitas
I tried the following query against WI-V1.5.2.4731 Firebird 1.5 :

SELECT CASE WHEN (val < 0) then 'C' ELSE 'D' END as CD,
SUM(val) AS TOT
FROM Lanto
WHERE (cod = '10010001')
GROUP BY 1

but it raises an exception class EIB_ISCError
ISC ERROR CODE:335544569
ISC ERROR MESSAGE:
Dynamic SQL Error
SQL error code = -104
Cannot use an aggregate function in a GROUP BY clause

First I supposed it was a FireBird error, but I submitted it directly
using IBOConsole Interactive SQL and it's OK. So it seems to be a
problem with IBO.
Is there something I can do about?