The format of the request with a floating point.
I have a request.
select (SELECT SUM(ostatok) FROM ostatky) AS ost
The result of the request is the number with a floating point. How to do what the result would be: if there is a fragment, then it shows a number with two signs after the comma, and if there is no fragment, then two zeros after the comma. How do you do that?
MySQL has a rounding function.
ROUND(n, m). n = number, m = bulbs after comma.
SELECT ROUND(10.555, 2)
UPD: There's still a function. http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_format it rounds the fragment and formats the number
#,###,###.##♪ After treatment by FORMAT, a comma can be replaced by a lacunae and a rounded number at the outlet with separate gaps
SELECT REPLACE(FORMAT(12345.678, 2), ',', ' ') # вывод 12 345.68