0

我可以就 SQL 语句寻求帮助吗?我必须内联计算,不能为它声明变量

计算:

-91000000 / 2700000 = -33.7037037037

我需要将余数(7037037037 - 但最多 6 个字符)乘以 15000

703703 / 15000 = 49.913533 的最终答案

我以为我可以这样做:

select cast(ParseName(abs(cast(-91000000 as decimal)/ 2700000 ) %1,1) as numeric(8,8)) / 15000
4

1 回答 1

1
WITH cte AS
(
    SELECT -91000000 AS x, 2700000 AS y
)
SELECT ABS(ROUND((CAST(x AS decimal) / CAST(y AS decimal)) - (x/y), 6)) * 1000000 / 15000 FROM CTE
于 2013-06-13T10:59:56.800 回答