select uid, sum(if(submit_time is null,1,0)) as incomplete_cnt, sum(if(submit_time is not null,1,0)) as complete_cnt, group_concat(distinct concat_ws(':',date_format(start_time,'%Y-%m-%d'),t2.tag ) separator ';') as detail from exam_record t1 join examination_info t2 on t1.exam_id = t2.exam_id and year(start_time) = 2021 where uid in (select distinct uid from exam_record where year(start_time) = 2021 group by uid having sum(if(score is not null,1,0)) >= 1 and sum(if(score is null,1,0)) < 5) group by uid having sum(if(score is null,1,0)) > 1 order by incomplete_cnt desc