with a as(
select
at.author_id,
case when at.author_level between 1 and 2 then '1-2级'
when at.author_level between 3 and 4 then '3-4级'
else '5-6级' end as level_cut
from author_tb as at
),
b as(
select
a.level_cut,
ant.issue_id
from
answer_tb as ant
left join a on ant.author_id = a.author_id
where
ant.char_len>=100
),
c as (
select
level_cut,
count(issue_id) as num
from
b
group by
level_cut
order by
num desc
)
select * from c

京公网安备 11010502036488号