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

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

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

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

全部评论
刚开始不能按照试卷和问题分别进行排序,之后看评论区先排序号再聚合
点赞 回复 分享
发布于 2023-08-04 17:31 江苏

相关推荐

10-10 00:14
门头沟学院 Java
程序员小白条:20年架构师,无工资
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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