不是说好的保证数量不一致吗?怎么例子里就出现数量一致的,还给我错了。只能把level也降序排序了。
SELECT ui.level level, COUNT(DISTINCT ui.uid) level_cnt FROM user_info ui INNER JOIN exam_record er ON ui.uid = er.uid INNER JOIN examination_info ei ON er.exam_id = ei.exam_id WHERE ei.tag = 'SQL' AND er.score > 80 GROUP BY ui.level ORDER BY level_cnt DESC, level DESC;