mysql round()函数以及convert()函数,保留n位小数

 

mysql> select round(2.232,2);
+----------------+
| round(2.232,2) |
+----------------+
|           2.23 |
+----------------+
1 row in set (0.00 sec)



mysql> select convert(1.2323,decimal(6,2));
+------------------------------+
| convert(1.2323,decimal(6,2)) |
+------------------------------+
|                         1.23 |
+------------------------------+
1 row in set (0.00 sec)

 

 

 

posted @ 2019-08-07 23:26  anobscureretreat  阅读(1387)  评论(0编辑  收藏  举报