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

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

https://www.nowcoder.com/practice/2ed07ff8f67a474d90523b88402e401b

#where nick_name like '牛客%号' and achievement between 1200 and 2500
#date_format(submit_time,'%Y-%m')='2021-09'

#把答题和答卷的,找出来2021-9有活跃的uid合并起来
#用到union 两个列相同的表,按行拼接起来,即去除掉2021-9没有活跃的用户
#再对应到user_info中,找到nick_name like '牛客%号'和成就between 1200 and 2500的用户

select distinct uid,nick_name,achievement
from user_info
     join 
     (select uid
     from exam_record
     where date_format(submit_time,'%Y-%m')='2021-09'
     union
     select uid
     from practice_record
     where date_format(submit_time,'%Y-%m')='2021-09'
     ) temp
      using(uid)
where nick_name like '牛客%号' 
      and achievement between 1200 and 2500
全部评论

相关推荐

10-27 17:26
东北大学 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务