Subject | RE: [firebird-support] "HAVING" Bug |
---|---|
Author | Leyne, Sean |
Post date | 2008-10-27T22:34:45Z |
Michael,
I suspect that the problem is that the glt_total has values that are not
truly zero -- your application is showing you zero when the database has
a value like 0.0000012313123.
Replace the HAVING clause with "having ABS(sum(glt_total)) <> 0"
Sean
> The following query returns all records including those withWhat is the datatype of the glt_total column?
> a zero sum(glt_total) the HAVING should be discarding them:
>
> select glt_group, sum(glt_total)
> from gltrans
> where glt_actperiod >= 200801
> group by glt_group
> having sum(glt_total) <> 0
> order by 2
>
>
> Also, it appears that if I change to <> to < then it will
> return records that are less than zero and equal to zero.
>
> If I change to <> to > then it will return records that are
> greater than zero and equal to zero.
I suspect that the problem is that the glt_total has values that are not
truly zero -- your application is showing you zero when the database has
a value like 0.0000012313123.
Replace the HAVING clause with "having ABS(sum(glt_total)) <> 0"
Sean