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

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

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

SELECT 
	uid, 
	count(incomplete) as incomplete_cnt,
    count(complete) as complete_cnt,
    group_concat(distinct concat_ws(':', date(start_time), tag) SEPARATOR ';') as detail
from (
    SELECT 
		uid, 
		tag, 
		start_time,
        if(submit_time is null, 1, null) as incomplete,
        if(submit_time is null, null, 1) as complete
    from exam_record 
    left join examination_info using(exam_id)
    where year(start_time)=2021
) as exam_complete_rec
group by uid
having complete_cnt >= 1 
and incomplete_cnt BETWEEN 2 and 4
order by incomplete_cnt DESC;

全部评论

相关推荐

12-19 15:21
已编辑
阿里巴巴_后端
点赞 评论 收藏
分享
安静的仰泳鲈鱼sp到手了:你这比赛获奖和实习,跟你的技术栈有半点关系吗😮
点赞 评论 收藏
分享
评论
1
收藏
分享
牛客网
牛客企业服务