我将以下公式放入mySQL

SELECT Order_Number,
Order_Date,
Product,
Quantity,
Price,
Commission,
Employee_Sold,
(Quantity*Price)*(Commission*.01) AS Commision_Paid
FROM Orders
WHERE Order_Date BETWEEN '2017-12-01' AND '2017-12-31'


佣金支付金额以2.992500为例。....

佣金字段设置为十进制(5,2)。

在这种情况下,扩展字段(Commission_Paid)最好显示为2.99。

我在很多地方都尝试过ROUND函数,但是由于不断收到错误消息,我不确定。

提前致谢。学生在这里,我的论文的截止日期。感激。

MySQL 5.5X正在运行。

最佳答案

使用回合(x,2)

SELECT Order_Number,
Order_Date,
Product,
Quantity,
Price,
Commission,
Employee_Sold,
round((Quantity*Price)*(Commission*.01), 2) AS Commision_Paid
FROM Orders
WHERE Order_Date BETWEEN '2017-12-01' AND '2017-12-31'

07-24 09:19