Beim Formatieren der Zahl auf 2 Dezimalstellen haben Sie zwei Möglichkeiten TRUNCATE und ROUND . Sie suchen nach TRUNCATE Funktion.
Beispiele:
Ohne Rundung:
TRUNCATE(0.166, 2)
-- will be evaluated to 0.16
TRUNCATE(0.164, 2)
-- will be evaluated to 0.16
docs:https://www.w3resource.com/mysql /mathematische-funktionen/mysql-truncate-function.php
Mit Rundung:
ROUND(0.166, 2)
-- will be evaluated to 0.17
ROUND(0.164, 2)
-- will be evaluated to 0.16
docs:https://www.w3resource.com/mysql /mathematische-funktionen/mysql-round-function.php