SELECT order_id, ROUND(10,2 (quantity * list_price) * (1-discount)) AS total_price
FROM order_items;
I am trying to round the total_price column to 2 decimal places but it is throwing me an error.
The number of decimal places of precision is the second parameter to ROUND
:
SELECT
order_id,
ROUND((quantity * list_price) * (1-discount), 2) AS total_price
FROM order_items;
syntax is ROUND (number, decimal , operation) Try
SELECT order_id, ROUND((quantity * list_price) * (1-discount),2,1) AS total_price
FROM order_items;
operation = 1 for round and operation = 0 for truncate.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.