下面是我目前使用的代码,我需要将最终结果舍入为2位小数。我假设我有太多,太少或错误的地方,当谈到"()"我的眼睛因试图将其分解并重建而流血。有人可以帮我弄清楚我做错了什么。
,Round((((Sum(case when S.StatType = 'Slot' then S.CashIn - S.CashOut - S.JackPot Else 0 end)*.75)+
(Sum(case when S.StatType = 'Pit' then S.CashIn + S.CreditIn + S.ChipsIn + S.FrontIn - S.CashOut Else 0 end)*.4))/Nullif(Count(Distinct(S.GamingDate)),0)),2) as ADL
答案 0 :(得分:1)
将其转换为小数而不是舍入:
CAST((((Sum(case when S.StatType = 'Slot' then S.CashIn - S.CashOut - S.JackPot Else 0 end)*.75)+
(Sum(case when S.StatType = 'Pit' then S.CashIn + S.CreditIn + S.ChipsIn + S.FrontIn - S.CashOut Else 0 end)*.4))/Nullif(Count(Distinct(S.GamingDate)),0)) AS DECIMAL(18,2)) as ADL