D
DragonInCity
Unregistered / Unconfirmed
GUEST, unregistred user!
select BillNo,<br>Profit=Sum(Convert(Money,Round(Isnull(SettleFy,0)*Isnull(SettleRate,0),2))),<br>Profit1=Round(Convert(Money,Sum(Isnull(SettleFy,0)*Isnull(SettleRate,0))),2)<br>from chgsettle where SettleNo='JSD8608070062' <br>group by BillNo<br>order by billno<br>=====================<br>BillNo Profit Profit1 <br>-------------------- --------------------- --------------------- <br>D86308070103 1290.4300 1290.4300<br>D86308070104 2169.0300 2169.0200<br>D86308070105 2169.0300 2169.0200<br>D86308070106 2169.0300 2169.0200<br>D86308070107 2169.0300 2169.0200<br>(所影响的行数为 5 行)<br>Profit=Sum(Convert(Money,Round(Isnull(SettleFy,0)*Isnull(SettleRate,0),2))),<br>--先保留小数点后两位小数,然后再汇总<br>Profit1=Round(Convert(Money,Sum(Isnull(SettleFy,0)*Isnull(SettleRate,0))),2)<br>--先汇总,然后再保留小数点后两位小数<br><br>按正常来说,应该是后一种写法产生的结果大,前一种产生的结果小;可实际执行的结果却是反过来了,请哪位大侠给解释一下这是为什么,谢谢了!