简体   繁体   English

SQL列更新与计算

[英]SQL column update with a calculation

How can I update the values in SQL column using multiplication and then divide it again? 如何使用乘法更新SQL列中的值,然后再次将其相除?

Values of column "price" need to be updated with "price" multiplied by 1.08 and then "price" divide by 1.077 必须将“价格”列的值更新为“价格”乘以1.08,然后将“价格”除以1.077

Thanks a lot for the help Andreas 非常感谢Andreas的帮助

Simply chain the arithmetic: 只需简单地算术:

update t
    set price = price * 1.08 / 1.077;

Multiplication and division can be done in the same operation. 乘法和除法可以在同一操作中完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM