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

分别满足两个活动的人

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

SELECT uid,'activity1' activity
FROM exam_record er INNER JOIN examination_info ei ON er.exam_id=ei.exam_id
GROUP BY uid
HAVING MIN(score)>=85
UNION
SELECT uid,'activity2' activity
FROM exam_record er INNER JOIN examination_info ei ON er.exam_id=ei.exam_id
WHERE score>80 AND difficulty='hard' 
AND TIMESTAMPDIFF(SECOND,start_time,submit_time)<=duration*60/2
ORDER BY uid
全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务