Mega Code Archive

 
Categories / MySQL Tutorial / String Functions
 

FORMAT(X,D)

Rounds X to D decimal places. Returns the result as a string. If D is 0, the result has no decimal point or fractional part. mysql> mysql> SELECT FORMAT(12332.123456, 4); +-------------------------+ | FORMAT(12332.123456, 4) | +-------------------------+ | 12,332.1235             | +-------------------------+ 1 row in set (0.00 sec) mysql>