SQL/MySQL/Math/TRUNCATE
Версия от 13:46, 26 мая 2010; (обсуждение)
Use TRUNCATE
/*
TRUNCATE function simply returns the supplied value X truncated to the
number of decimal places equal to the supplied value D
*/
select TRUNCATE(113, -2);
select TRUNCATE(113, -1);
/*
mysql> select TRUNCATE(113, -2);
+-------------------+
| TRUNCATE(113, -2) |
+-------------------+
| 100 |
+-------------------+
1 row in set (0.00 sec)
mysql> select TRUNCATE(113, -1);
+-------------------+
| TRUNCATE(113, -1) |
+-------------------+
| 110 |
+-------------------+
1 row in set (0.00 sec)
*/