SELECT order_id, ROUND(10,2 (quantity * list_price) * (1-discount)) AS total_price
FROM order_items;
我正在尝试将total_price列四舍五入到小数点后两位,但这会引发错误。
精度的小数位数是ROUND
的秒参数:
SELECT
order_id,
ROUND((quantity * list_price) * (1-discount), 2) AS total_price
FROM order_items;
语法为ROUND(数字,小数,运算符)尝试
SELECT order_id, ROUND((quantity * list_price) * (1-discount),2,1) AS total_price
FROM order_items;
[运算= 1表示回合,运算= 0表示截断。