How To rounded to the lowest multiple of 5 in SQL SERVER 2008?
how to round a number to the开发者_JS百科 minimum number that is a multiple of 5
Examples:
- if we have 49 it should be rounded to 45 not 50
- if we have 54 it should be rounded to 50.
This is wrong:
SELECT ROUND(49, -1)
Integer arithmetic will do it
SELECT FLOOR(49/5) * 5, FLOOR(54/5) * 5
精彩评论