题解 | 统计有未完成状态的试卷的未完成数和未完成率

select
    exam_id,
    sum(if (submit_time is null, 1, 0)) incomplete_cnt,
    round(
        sum(if (submit_time is null, 1, 0)) / count(exam_id),
        3
    ) incomplete_rate
from
    test.exam_record
group by
    exam_id
having
    incomplete_cnt != 0

全部评论

相关推荐

04-14 20:10
已编辑
门头沟学院 Java
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务