题解 | #分别满足两个活动的人#注意时间函数的处理,换成秒来算
分别满足两个活动的人
http://www.nowcoder.com/practice/a126cea91d7045e399b8ecdcadfb326f
select uid,'activity1' as activity from exam_record t1 where year(submit_time) = 2021 group by uid having min(score) >= 85 union all select distinct uid,'activity2' as activity from exam_record t1 join examination_info t2 on t1.exam_id = t2.exam_id where year(submit_time) = 2021 and t2.difficulty = 'hard' and t1.score > 80 and (t2.duration * 60)/timestampdiff(second,start_time,submit_time) >= 2 order by uid