count_nullable_sub.sql 249 B

12345678
  1. select
  2. count(val) as subkey,
  3. cast(avg(val) as int) as value,
  4. value as key
  5. from
  6. (select case key when '0' then NULL else cast(subkey as int) / cast(key as int) end as val, value from plato.Input2) as res
  7. group by value
  8. order by value;