Reputation: 707
I am trying to round the value to highest 0.5 value.
For example if i execute
select round(5.456);
Then I want to get the result as 5.5 and if I execute
select round(5.73434);
Then I want to get the result as 6.
That is if value is between 0 and 0.5 then it must be rounded to 0.5 and if the value is between 0.5 and 1 then it must be rounded to 1.
How can I do this? Thanks in advance
Upvotes: 4
Views: 3354
Reputation: 7270
Might not the cleanest solution, but should do the trick:
select (CEILING(5.456 / 0.5) * 0.5)
CEILING
is returning the higher value as shown in documentation.
Upvotes: 8