题解 | #每个题目和每份试卷被作答的人数和次数#
每个题目和每份试卷被作答的人数和次数
https://www.nowcoder.com/practice/203d0aed8928429a8978185d9a03babc
# 这是union如何解决排序机制的问题吧?就是套一个select * from 在from得子表里order by好
select * from
(select exam_id tid,count(distinct uid) uv,count(uid) pv
from exam_record
group by exam_id
order by uv desc,pv desc
) t1
union
select * from
(select question_id tid,count(distinct uid) uv,count(uid) pv
from practice_record
group by question_id
order by uv desc,pv desc
) t2