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

分别满足两个活动的人

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

select
    distinct uid,
    "activity1" as activity
from
    exam_record t1
    left join examination_info t2 on t1.exam_id = t2.exam_id
where
    year (submit_time) = 2021
    and uid not in (
        select
            uid
        from
            exam_record t1
            left join examination_info t2 on t1.exam_id = t2.exam_id
        where
            year (submit_time) = 2021
            and score < 85
    )
union all
select
    distinct uid,"activity2" as activity
from
    exam_record t1
    left join examination_info t2 on t1.exam_id = t2.exam_id
where
    score > 80
    and timestampdiff(MINUTE,start_time,submit_time) < duration/2
    and difficulty ="hard"
order by
    uid

全部评论

相关推荐

昨天 18:05
门头沟学院 Java
挂了&nbsp;正式批求捞
投递滴滴等公司10个岗位
点赞 评论 收藏
分享
06-10 23:36
已编辑
首都经济贸易大学 C++
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务