How would I round down to the nearest integer in MySQL?
Example: 12345.7344 rounds to 12345
12345.7344 rounds to 12345
mysql\'s round() function rounds up.>
round()
SUBSTR will be better than FLOOR in some cases because FLOOR has a "bug" as follow:
SUBSTR
FLOOR
SELECT 25 * 9.54 + 0.5 -> 239.00 SELECT FLOOR(25 * 9.54 + 0.5) -> 238 (oops!) SELECT SUBSTR((25*9.54+0.5),1,LOCATE('.',(25*9.54+0.5)) - 1) -> 239