我有一张产品表,存放原价和折扣百分比:
mysql> select * from products;
+---------------+--------+-----------+--------+
| concept | price | discount | currency |
+---------------+--------+-----------+--------+
| yyy | 1 | 0.00 | usd |
| xxx | 10 | 50.00 | usd |
+---------------+--------+-----------+--------+如何使用“价格”和“折扣”列计算选定阶段中每一项的总价,以便得到以下内容
mysql> select ???????
+---------------+--------+--------+
| concepto | total | currency |
+---------------+--------+--------+
| yyy | 1 | usd |
| xxx | 5 | usd |
+---------------+--------+--------+发布于 2020-06-01 19:46:35
这是简单的算术:
select
concept,
price * (1 - discount / 100) total,
currency
from productshttps://stackoverflow.com/questions/62139829
复制相似问题