2016-05-09 13:36 GMT+02:00 OBones <obones at free.fr>: > Cecil Westerhof wrote: > >> I need to have a CEIL function in SQLite. This is the way I implemented >> it: >> WITH percentage AS ( >> SELECT date >> , 100.0 * rank / outOf AS percentage >> , CAST(100.0 * rank / outOf AS int) AS castedPercentage >> FROM ranking >> ) >> SELECT date >> , (CASE WHEN percentage = castedPercentage >> THEN castedPercentage >> ELSE castedPercentage + 1 >> END) AS percentage >> FROM percentage >> >> Is this a good way, or is there a better way? >> > Isn't Ceil(Value) simply Round(Value + 0.5) ? >
?That was my first thought. But when playing with it, I ran into some edge cases. But maybe I should not worry to much about those. ;-) -- Cecil Westerhof