mysql sum 聚合计算后精度不准 出现多位小数点后的数

解决办法

原收款单money 字段 为 decimal(28,8) 经过层层计算用到了

        @total := ( beginning + @total + gather - verification ) AS 'balance',
        @num := ( @num + 1 ) AS 'num'

办法为最后取时字段加

        cast(balance as DECIMAL(28, 2)) as balance,

posted on 2023-03-02 15:12  何苦->  阅读(825)  评论(0)    收藏  举报

导航