Reputation: 2140
When I do something like this:
SELECT AVG(Price) FROM Product WHERE ProductName = 'Shoe';
the SQL returns something like this: 6,5934348324242
An average number with a lot of digits.
Is it possible to do something in the query so the query returns 2/3 digits (for example: 6,59) instead of 10+ digits?
I am using MySql
Upvotes: 1
Views: 2339
Reputation: 1270431
You can convert it to a decimal:
SELECT cast(AVG(Price) as decimal(6, 2))
FROM Product
WHERE ProductName = 'Shoe';
Upvotes: 5