【详述】对表int类型字段先除以100再累加结果不准确,语句如下,txamt 字段类型为int(11):
select a.cust_id, count(a.USTLDAT) bs,sum(a.txamt )/100 je,sum(cast(a.txamt as decimal)/100 ) je,sum(a.txamt /100 ) je
from xxx.xxxx a
where a.USTLDAT between ‘20210101’ and ‘20211231’
and a.order_status in (‘1’, ‘4’,‘5’)
and a.cust_id=‘60000001203674’
group by a.cust_id
【业务影响】:查询结果正常应只有2位小数,现在的查询结果有点差异,请问是否只能把这个字段txamt设置为decimal类型
【StarRocks版本】:2.1.2 0782ad7
【集群规模】:3fe(3 follower)+4be(3个be与fe混部)
【机器信息】CPU虚拟核/内存/网卡,40C/128G/万兆
