题解 | #分别满足两个活动的人#

分别满足两个活动的人

https://www.nowcoder.com/practice/a126cea91d7045e399b8ecdcadfb326f

select uid,'activity1' activity from exam_record er
join examination_info ei
on er.exam_id=ei.exam_id
where uid not in (select uid from exam_record where score<85) and year(start_time)=2021
union
select uid,'activity2' activity from exam_record er
join examination_info ei
on er.exam_id=ei.exam_id
where timestampdiff(second,start_time,submit_time)<=duration*30 and score>80 and difficulty='hard'
and year(start_time)=2021
order by uid;

成绩全部大于等于85,只要uid不在有一个成绩小于85的组中就行

timestampdiff(unit,begin,end),返回end-begin的结果,单位为unit(如second,minute等)

全部评论

相关推荐

10-25 02:13
门头沟学院 C++
牛客7351937293号:8.27笔试10.22评估
投递小米集团等公司10个岗位
点赞 评论 收藏
分享
想润的芹菜人狠话不多:把其中一个老总放中间都会得罪另一个
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务