Home > Enterprise >  how round 4 decimals MySQL?
how round 4 decimals MySQL?

Time:09-16

how can i round this number 237.704918 to 237.71 in mysql? i try round but the result is 237.7, thks!

CodePudding user response:

ROUND(number, 2) rounds to the nearest value, and .704918 is closer to .70 than .71.

If you always want to round up to the next multiple of .01, multiply by 100, round up with CEIL(), and then divide by 100.

ROUND(CEIL(number * 100) / 100, 2)
  • Related