题解 | #筛选限定昵称成就值活跃日期的用户#
筛选限定昵称成就值活跃日期的用户
https://www.nowcoder.com/practice/2ed07ff8f67a474d90523b88402e401b
with t as ( #先造一个总表 分别从exam_record 和 practice_record 表查询 用union连接 select uid,nick_name,achievement,date_format(start_time,'%Y%m') as time from exam_record left join user_info using(uid) where nick_name like '牛客%号%' # #筛选符合条件的nick_name union select uid,nick_name,achievement,date_format(submit_time,'%Y%m') as time from practice_record left join user_info using(uid) where nick_name like '牛客%号%' ) #筛选符合条件的nick_name select uid,nick_name,achievement from t where achievement between 1200 and 2500 and time = 202109 #选择成就值1200-2500 以及活跃时间在202109