Syntax
TRUNCATE(X,D)
Purpose
You can call this function to return the value of X with D decimal places retained. If D is 0, the integer part of X is returned. If D is negative, D digits to the left of the decimal point of X become 0.
Examples
obclient> SELECT TRUNCATE(3.27,1);
+------------------+
TRUNCATE(3.27,1)
+------------------+
3.2
+------------------+
1 row in set (0.00 sec)
obclient> SELECT TRUNCATE(3.27,0);
+------------------+
TRUNCATE(3.27,0)
+------------------+
3
+------------------+
1 row in set (0.00 sec)
obclient> SELECT TRUNCATE(3.27,-1);
+-------------------+
TRUNCATE(3.27,-1)
+-------------------+
0
+-------------------+
1 row in set (0.00 sec)