Format the number to display with commas separating every three digits, and round it to two decimal places.
SELECT FORMAT(250500.5634, 2); |
The FORMAT() function formats a number into a specific format, such as “#,###,###.##”, with rounding to a specified number of decimal places, and returns the result as a string.
FORMAT(number, decimal_places) |
Parameter |
Description |
number |
Necessary: The number that requires formatting. |
decimal_places |
Necessary: The number of decimal places to be included in the formatted number. If set to 0, the function returns a string without decimal places. |
Works in: | From MySQL 4.0 |
Format the number according to the pattern “#,###,###.##” with no decimal places.
SELECT FORMAT(250500.5634, 0); |