题解 | #每个题目和每份试卷被作答的人数和次数#
每个题目和每份试卷被作答的人数和次数
https://www.nowcoder.com/practice/203d0aed8928429a8978185d9a03babc
select tid, uv, pv from (select 1 as exam, t1.exam_id as tid, count(distinct t1.uid) as uv, count(t1.exam_id) as pv from exam_record t1 group by t1.exam_id union all select 2 as exam, t2.question_id as tid, count(distinct t2.uid) as uv, count(t2.question_id) as pv from practice_record t2 group by t2.question_id) t order by t.exam asc,t.uv desc,t.pv desc