select uid,'activity1' as activity from examination_info ei join exam_record er on ei.exam_id=er.exam_id where score >= 85 and year(start_time)=2021 union select distinct uid,'activity2' as activity from examination_info ei join exam_record er on ei.exam_id=er.exam_id where difficulty ='hard' and score>80 and timestampdiff(second,start_time,submit_time)/60<=0.5*duration and year(start_time)=2021 order by uid
分别求a1 和a2,然后union 起来