题解 | #分别满足两个活动的人#
分别满足两个活动的人
http://www.nowcoder.com/practice/a126cea91d7045e399b8ecdcadfb326f
用不在小于85分的人里来筛出每套试卷分数均大于85分的人,少了group操作
from exam_record where year(start_time) = 2021 and uid not in
(select uid from exam_record where score < 85)
union
select uid,'activity2' as activity
from exam_record join examination_info using(exam_id)
where difficulty = 'hard' and timestampdiff(second,start_time,submit_time) < duration*30
and year(start_time) = 2021
order by uid