Problem: I want to know the percentage of heights between 0 and 3, between 3 and 5, etc etc.
I'm able to calculate the absolute values here:
SELECT t.classes, count(*) FROM (select case
WHEN height BETWEEN 0 and 3 then 0
WHEN height BETWEEN 3 and 5 then 1
WHEN height BETWEEN 5 and 7 then 2
WHEN height BETWEEN 7 and 9 then 3
WHEN height BETWEEN 9 and 11 then 4
WHEN height > 11 then 5
end as classes from lkp0201val) t, group by classes order by classes
and I'm able to calculate the total number of points:
select count(*) from lkp0101val;
... but I don't now how to apply that count value to the first statement.