题解 | #未完成试卷数大于1的有效用户#

未完成试卷数大于1的有效用户

https://www.nowcoder.com/practice/46cb7a33f7204f3ba7f6536d2fc04286

with data_f_use as (
select uid, exam_id, if(submit_time is null, 1, 0) as incomplete,
        if(submit_time is null, 0, 1) as complete, start_time
from exam_record
where year(start_time) = 2021 
)
    select uid, sum(incomplete) as incomplete_cnt, 
        sum(complete) as complete_cnt, 
        group_concat(distinct concat_ws(':', substr(start_time, 1, 10), tag) separator ';')
    from data_f_use
    left join examination_info using (exam_id)
    group by uid
    having (incomplete_cnt between 2 and 4) and complete_cnt >= 1
    order by incomplete_cnt desc


全部评论

相关推荐

不愿透露姓名的神秘牛友
昨天 15:19
简历上能写3个月吗?
码农索隆:大胆写,主要你能把实习经历包装好,可以看一下我这篇帖子https://www.nowcoder.com/share/jump/4888395581180798063
点赞 评论 收藏
分享
头顶尖尖的程序员:我是26届的不太懂,25届不应该是找的正式工作吗?为什么还在找实习?大四还实习的话是为了能转正的的岗位吗
点赞 评论 收藏
分享
06-05 19:46
已编辑
武汉大学 后端
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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