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

分别满足两个活动的人

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

TIMESTAMPDIFF的minute参数有坑,分钟是直接截断的,为了准确用seconds参数

select 
    uid,
    'activity1' as activity
from exam_record
group by uid
having min(score) >= 85

union all

select 
    distinct uid as uid,
    'activity2' as activity
from exam_record a 
inner join examination_info b on a.exam_id=b.exam_id
where b.difficulty='hard' 
    and  (b.duration*60/2 - TIMESTAMPDIFF(SECOND, start_time, submit_time)) >= 0
    and score > 80
order by uid
全部评论

相关推荐

11-02 09:49
已编辑
货拉拉_测试(实习员工)
热爱生活的仰泳鲈鱼求你们别卷了:没事楼主,有反转查看图片
点赞 评论 收藏
分享
1 收藏 评论
分享
牛客网
牛客企业服务