如何在T-SQL中将小数部分等于0的数字显示为整数


所需输出8552.2536.85
第1列 数量
第1项 85.00
第2项 52.25
第3项 36.85
第4项 67.00 67

这里有一个解决方案

select *,
case when
amount = floor(amount) then FORMAT(amount, 'N0')
else
FORMAT(amount, 'N2')
end as roundedPrice
from MyTable

相关内容

最新更新