(select distinct uid, 'activity2' as activity from exam_record left join examination_info on exam_record.exam_id=examination_info.exam_id where difficulty='hard' and timestampdiff(minute,start_time,submit_time)<0.5*duration and score>80) union all (select distinct uid, 'activity1' as activity ...