首页 > 代码库 > TRUNCATE(x,y)

TRUNCATE(x,y)

TRUNCATE(x,y) 用于对 x 进行截取,结果保留小数点后 y 位

mysql> SELECT TRUNCATE(1.31,1), TRUNCATE(1.99,1), TRUNCATE(1.99,0);+------------------+------------------+------------------+| TRUNCATE(1.31,1) | TRUNCATE(1.99,1) | TRUNCATE(1.99,0) |+------------------+------------------+------------------+|              1.3 |              1.9 |                1 |+------------------+------------------+------------------+

 

 

 

 

    

TRUNCATE(x,y)