Al formatear el número a 2 decimales, tiene dos opciones TRUNCATE
y ROUND
. Estás buscando TRUNCATE
función.
Ejemplos:
Sin redondeo:
TRUNCATE(0.166, 2)
-- will be evaluated to 0.16
TRUNCATE(0.164, 2)
-- will be evaluated to 0.16
documentos:http://www.w3resource.com/mysql /funciones-matemáticas/mysql-truncate-function.php
Con redondeo:
ROUND(0.166, 2)
-- will be evaluated to 0.17
ROUND(0.164, 2)
-- will be evaluated to 0.16
documentos:http://www.w3resource.com/mysql /funciones-matemáticas/mysql-round-function.php