I have table which the value is float, and I want to round up the value to integer if the value is more than 0.30
the columns look like this:
weight
2.31
2.50
2.76
2.45
I use cast(round(weight,0) as int)
to round up the weight but it rounds up 2.31 and 2.35 to 2 while I expect to be rounded up to 3. So if it's more than 0.3 then it should be rounded up while if it's less than 0.3 then it should rounded down
How can I do this in redshift sql?
Thank you in advance
You can do it by adding 0.2
to the weight then round()
:
cast(round(weight + 0.2) as int)