select seq,
count(1) n
from (
select case when t.num>10 and t.num<=15 then 'a_10_15'
when t.num>15 and t.num<=30 then 'a_15_30'
when t.num>30 and t.num<=40 then 'a_30_40' else null end seq;
from table t
) group by seq
------解决方案--------------------
------解决方案-------------------- 引用:
SQL code
select case when num > = 10 and num < 15 then '10~15 ' when num > = 15 and num < 30 then '15~30 ' when num > = 30 and num < 40 then '30~40 ' else null ……