round(x,y)和format(x,y)

select round(123456.1456,2);
+----------------------+
| round(123456.1456,2) |
+----------------------+
|            123456.15 |
+----------------------+

select format(123456.1456,2);
+-----------------------+
| format(123456.1456,2) |
+-----------------------+
| 123,456.15            |
+-----------------------+

round()和format()都会对数值进行四舍五入,但是format()返回的是字符串,整数部分,每3位添加一个逗号。round()返回的仍然是数值

posted @ 2018-07-04 15:26  Tinypan  阅读(497)  评论(0)    收藏  举报