Subject | Re: casting to decimal(9,2) gives different answers if used with a group by clause |
---|---|
Author | emb_blaster |
Post date | 2009-04-16T16:32:13Z |
--- In firebird-support@yahoogroups.com, "wibbleian2" <wibbleian2@...> wrote:
I think the problem is not realy *only* about the group by...
Did you notice that "cast the sum" results diff than "sum the cast".
Try the below SQL
SQL> select sum(cast(qty as decimal(9,2))) from tmp;
SY,
>Hi Ian,
> SQL> select cast(sum(qty) as decimal(9,2)) from tmp;
>
> CAST
> ============
>
> 130.28
>
I think the problem is not realy *only* about the group by...
Did you notice that "cast the sum" results diff than "sum the cast".
Try the below SQL
SQL> select sum(cast(qty as decimal(9,2))) from tmp;
> CASTI´m not good with FB internals work, so I let to anyone explain the diff in this case (maybe Helen?).
> ============
>
> 130.27
SY,