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

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

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

select * from (select exam_id as tid, count(distinct uid) uv, count(exam_id) pv
from exam_record group by tid order by uv desc, pv desc)t1
union all
select * from (select question_id as tid, count(distinct uid) uv, count(submit_time) pv
from practice_record group by tid order by uv desc, pv desc)t2;

order by在union中不起作用,必须放到子句中去

全部评论

相关推荐

天降大厂offer:你是我见过最美的牛客女孩
点赞 评论 收藏
分享
青春运维少年不会梦到...:实习大王
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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