select * from (select '5-6级' as level_cut, sum(if(author_level = 5 or author_level = 6,1,0)) as num from answer_tb left join author_tb using(author_id) where char_len >= 100 union select '3-4级' as level_cut, sum(if(author_level = 3 or author_level = 4,1,0)) as num from answer_tb left join author_tb using(author_id) where char_len >= 100 union select '1-2级' as level_cut, sum(if(author_level = 1 or author_level = 2,1,0)) as num from answer_tb left join author_tb using(author_id) where char_len >= 100) t1 where num != 0 order by num desc,level_cut
没啥好说的,挺傻的