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

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

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条件判断即可

全部评论

相关推荐

点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务