requete sql : arrondir une colonne a 2 décimales - SQL/NoSQL - Programmation
Marsh Posté le 31-05-2007 à 15:12:25
TRUNCATE(X,D)
Returns the number X, truncated to D decimal places. If D is 0, the result has no decimal point or fractional part. D can be negative to cause D digits left of the decimal point of the value X to become zero.
mysql> SELECT TRUNCATE(1.223,1);
-> 1.2
mysql> SELECT TRUNCATE(1.999,1);
-> 1.9
mysql> SELECT TRUNCATE(1.999,0);
-> 1
mysql> SELECT TRUNCATE(-1.999,1);
-> -1.9
mysql> SELECT TRUNCATE(122,-2);
-> 100
mysql> SELECT TRUNCATE(10.28*100,0);
-> 1028
All numbers are rounded toward zero.
Marsh Posté le 31-05-2007 à 14:33:12
Bonjour,
Existe-il un moyen en SQL d'arrondir les champs décimaux à 2 décimales après la virgule ?
Merci