数字溢出 - 在限制结果时起作用,不适用于完整查询
Numeric Overflow - works when limiting results, not for full query
我在 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
我在 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