我正在使用Microsoft SQL Server,我需要将my_table中的所有价格更新4%
我在stackoverflow上找到了以前的答案,我知道正确的方法应该是:
UPDATE my_table SET price = (price * 1.4)
但我的客户希望价格四舍五入。因此,如果结果为90,4则必须为90,如果为90.7,则必须为91。
可能吗?
使用ROUND()
:
UPDATE my_table
SET price = ROUND(price * 1.4, 0);