题解 | 筛选限定昵称成就值活跃日期的用户

select
    uid,
    nick_name,
    achievement
from
    test.user_info
where
    uid in (
        select
            uid
        from
            (
                select
                    uid,
                    date_format (time, '%Y%m') 月份,
                    rank() over (
                        partition by
                            uid
                        order by
                            time desc
                    ) 排名
                from
                    (
                        select
                            uid,
                            exam_id tid,
                            start_time time,
                            score
                        from
                            test.exam_record
                        union
                        select
                            uid,
                            question_id tid,
                            practice_record.submit_time time,
                            score
                        from
                            test.practice_record
                    ) a
                where
                    uid in (
                        select
                            uid
                        from
                            test.user_info
                        where
                            nick_name like '牛客%号'
                            and achievement between 1200 and 2500
                    )
            ) b
        where
            排名 = 1
            and 月份 = '202109'
    )

全部评论

相关推荐

06-07 17:17
嘉兴学院 教师
心爱的idea:你孩
点赞 评论 收藏
分享
07-02 18:09
门头沟学院 Java
苍穹外卖和谷粒商城这俩是不是烂大街了,还能做吗?
想去重庆的鸽子在吐槽:你不如把这俩做完自己搞明白再优化点再来问 何必贩卖焦虑
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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