mysql 去掉小数点后的多余的0

0+CAST(IFNULL(format(jct.car_weight*0.001,3),0) as CHAR) as car_weight, -- 车辆自重
            0+CAST(IFNULL(format(je.goods_weight*0.001,3),0) as CHAR) as goods_weight, -- 商品总重
            0+CAST(IFNULL(format(je.declaration_weight*0.001,3),0)as CHAR) as declaration_weight, -- 申报重量
            0+CAST(IFNULL(format(je.unit_weight*0.001,3),0)as CHAR) as unit_weight, -- 每件的重量

select 0+CAST(9/2 as char); 得出的结果是4.5

你可能感兴趣的:(mysql 去掉小数点后的多余的0)