select
level_cut,sum(cnt) num
from
(
select
case when a.author_level>=1 and a.author_level<=2 then '1-2级'
when a.author_level>=3 and a.author_level<=4 then '3-4级'
when a.author_level>=5 and a.author_level<=6 then '5-6级'
else '0' end as level_cut,
count(1) cnt
from
author_tb a,
answer_tb b
where
a.author_id = b.author_id
and char_len > 100
group by
a.author_level
) c
group by c.level_cut
order by sum(cnt) desc

京公网安备 11010502036488号