我在TD中获得了数字溢出问题。
`select
a1.account_name,
a1.merch_total_units,
sum(a1.merch_total_units) OVER (order by a1.merch_total_units rows
BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) as running_total,
cast (running_total as decimal (8,4))*100/12767296.0000
from sandbox.merchants_total_units a1
group by 1,2,3
order by 3 desc`
有趣的是,当过滤到运行总计时,查询可以正常工作。例如:
`select
a1.account_name,
a1.merch_total_units,
sum(a1.merch_total_units) OVER (order by a1.merch_total_units rows
BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) as running_total,
cast (running_total as decimal (8,4))*100/12767296.0000
from sandbox.merchants_total_units a1
where a1.merch_total_units > 5000
group by 1,2,3
order by 3 desc`
我尝试通过代码在每个级别上更改#decimal点,不起作用
增加十进制的长度
cast (running_total as decimal (18,4))*100/12767296.0000