题解 | #筛选限定昵称成就值活跃日期的用户#
筛选限定昵称成就值活跃日期的用户
https://www.nowcoder.com/practice/2ed07ff8f67a474d90523b88402e401b
with t1 as (select uid,max(start_time) as last_time
from exam_record
group by uid
union all
select uid, max(submit_time) as last_time
from practice_record
group by uid),
t2 as (select uid, date_format(max(last_time),'%Y%m') as last_time
from t1
group by uid)
select uid, nick_name,achievement
from user_info as a
join t2 using(uid)
where t2.last_time='202109'
and achievement between 1200 and 2500
and nick_name like ('牛客%号')
可以用union来找出两个作答表的最近活跃时间,然后连接user_info进行where条件判断即可
