题解 | #每个题目和每份试卷被作答的人数和次数#

每个题目和每份试卷被作答的人数和次数

https://www.nowcoder.com/practice/203d0aed8928429a8978185d9a03babc

这道题的关键在于union的排序的使用

select * from
(select exam_id as tid,
count(distinct uid) as uv,
count(1) as pv
from exam_record
group by exam_id
order by uv desc,pv desc
) as ta
union all
select * from
(
select question_id as tid,
count(distinct uid) as uv,
count(1) as pv
from practice_record
group by question_id
order by uv desc,pv desc) as tb

全部评论

相关推荐

评论
1
1
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务