题解 | #未完成试卷数大于1的有效用户#
未完成试卷数大于1的有效用户
http://www.nowcoder.com/practice/46cb7a33f7204f3ba7f6536d2fc04286
select uid,sum(if(submit_time is null,1,0)) as ncnt, count(submit_time) as cnt ,
GROUP_CONCAT(distinct date(start_time),":",tag order by date(start_time),tag separator ';')
from exam_record
join examination_info ei
on exam_record.exam_id = ei.exam_id
where year(start_time) = 2021
group by uid
having cnt >= 1 and ncnt BETWEEN 2 and 4
order by ncnt desc;