Subject RE: [firebird-support] WHERE and IIF
Author Alan McDonald
> The function the IIF gives me error within the WHERE in the
> equal sign indicated in red. (Second equal sign after
> function IIF --> cofaccob.entidad='2578')
>
> select cofaccob.entidad, cofaccob.docemp, sum(cofaccob.haber)
> as haber from cofaccob where iif(cofaccob.clave='CS',
> cofaccob.entidad='2578', cofaccob.entidad='2580') group by
> cofaccob.entidad, cofaccob.docemp order by cofaccob.docemp
>
> As would you solve this problem?
>
> Thank you for everything....
> =========
> || ISMAEL ||
> =========

You need to provide the test in the where clause.

> select cofaccob.entidad, cofaccob.docemp, sum(cofaccob.haber)
> as haber from cofaccob
where iif(cofaccob.clave='CS',
cofaccob.entidad='2578', cofaccob.entidad='2580') =2578
> group by
> cofaccob.entidad, cofaccob.docemp order by cofaccob.docemp

Or some such
Alan