题解 | #筛选限定昵称成就值活跃日期的用户#
筛选限定昵称成就值活跃日期的用户
https://www.nowcoder.com/practice/2ed07ff8f67a474d90523b88402e401b
# 找到昵称以『牛客』开头『号』结尾、成就值在1200~2500之间,且最近一次活跃(答题或作答试卷)在2021年9月的用户信息。 select ui.uid, ui.nick_name, achievement from user_info ui left join exam_record er on ui.uid = er.uid left join practice_record pr on ui.uid = pr.uid where nick_name like '牛客%号' and achievement between 1200 and 2500 group by uid having date_format(max(er.submit_time),'%Y%m') = 202109 or date_format(max(pr.submit_time),'%Y%m') = 202109