Subject Re: casting to decimal(9,2) gives different answers if used with a group by clause
Author emb_blaster
--- In firebird-support@yahoogroups.com, "wibbleian2" <wibbleian2@...> wrote:
>
> SQL> select cast(sum(qty) as decimal(9,2)) from tmp;
>
> CAST
> ============
>
> 130.28
>

Hi Ian,

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;
> CAST
> ============
>
> 130.27

I´m not good with FB internals work, so I let to anyone explain the diff in this case (maybe Helen?).

SY,