MySQL round()函數
ROUND(X)
ROUND(X,D)
此函數返回x舍入到最接近的整數。如果第二個參數,D有提供,則函數返回x四舍五入至第D位小數點。D必須是正數或全部右邊小數點的數字將被刪除。請看下麵的例子:
mysql>SELECT ROUND(5.693893); +---------------------------------------------------------+ | ROUND(5.693893) | +---------------------------------------------------------+ | 6 | +---------------------------------------------------------+ 1 row in set (0.00 sec) mysql>SELECT ROUND(5.693893,2); +---------------------------------------------------------+ | ROUND(5.693893,2) | +---------------------------------------------------------+ | 5.69 | +---------------------------------------------------------+ 1 row in set (0.00 sec)