• This have to do with how CASE works.

    One thing is that a CASE can only return one datatype - which one if there are multiple datatypes within the same CASE expression, is determined by prescedence.

    (if not explicitly casted)

    CASE also only evaluates if the expression is true or false.

    Now.... the column checked is a float, but for the values above 1 all seems to work, but for those less than one it seems not.. Why is this?

    The thing is - the datatype used to calculate within each CASE is - int.

    This is because you say - if true then return 1 else 0

    These two are integers

    ..and they cause the case to convert the values to check and then return to an int also.

    So, all the low results are rounded up - thus they evaluate to the same sums and counts...

    One way to fix this seems to be to say

    WHEN column < 0.01 THEN 0.01 ELSE 0. END

    WHEN column < 0.001 THEN 0.001 ELSE 0. END

    WHEN column 0 when the condition is true - it will also return 0.001 instead of a single 1, but how to count that is left as an excercise for the reader.

    /Kenneth