I'm working on an assignment for class and I've been stuck for about two hours on this question:
"Project the invoice average total price, minimum total price, and maximum total price. Money is always formatted to two decimal places."
So, I came up with this query:
SELECT
CONVERT(DECIMAL(8),AVG(INV.TotalPrice),2) AS 'Average Price',
CONVERT(DECIMAL(8),MIN(INV.TotalPrice),2) AS 'Miniumum Price',
CONVERT(DECIMAL(8),MAX(INV.TotalPrice),2) AS 'Maximum Price'
FROM INVOICE INV;
The mathematical functions are working just fine but I'm unable to get to numbers after a decimal point, and the decimal point itself, after the price. For example, on 'Average Price,' I get an output of "187" but I need "187.00."
I'm a little stuck. I've tried looking through the other questions on Stack Overflow but I haven't found one that addresses my specific concerns. Any help would be appreciated.