Subject Re: Aggregate function with CASE and GROUP BY clauses
Author Svein Erling Tysvær
I ran my test using the Cursor tab in IB_SQL, and I think both IB_SQL
and IBOConsole use IBO. Hence, I assume it is something to do with
your setup and not IBO itself. You haven't accidentally put something
like GROUP BY 1, SUM(val) in your group by clause (WHEN is not an
aggregate function and ought to give another error if that was the
cause of your error)? Try using a TIB_MONITOR (or similar, I don't
remember the name) to see what actually gets passed to Firebird.


--- In, "Roberto Freitas" wrote:
> 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')
> but it raises an exception class EIB_ISCError
> ISC ERROR CODE:335544569
> 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?