DEV Community

dan-simiyu
dan-simiyu

Posted on

Answer: MySQL Round Up to Nearest 5 Cents

Since 100/5 = 20 all we do is multiply by 20, round up to the nearest whole number, and then divide by 20.

(To round up in MySQL use CEIL)

Example for $1.03:

1.03 * 20   = 20.60
CEIL(20.60) = 21.0000
21 / 20     = 1.0500

NOTE: I also round…

Top comments (0)