题解 | #统计每个学校各难度的用户平均刷题数#
统计每个学校各难度的用户平均刷题数
https://www.nowcoder.com/practice/5400df085a034f88b2e17941ab338ee8
SELECT university,difficult_level,qnum/snum FROM( SELECT university,difficult_level,count(q.question_id) as qnum,count(distinct q.device_id) as snum FROM question_practice_detail as q LEFT JOIN question_detail as qd ON q.question_id=qd.question_id LEFT JOIN user_profile as u ON q.device_id=u.device_id GROUP BY university,difficult_level )as temp注意是否要distinct