select uid, nick_name, achievement
from user_info
where nick_name LIKE '牛客%号'
and achievement BETWEEN 1200 and 2500
and uid in (select er.uid
from exam_record as er
left join practice_record as pr on er.uid = pr.uid
# 错误:
# where (max(year(start_time)) = 2021 and max(month(start_time)) = 9)
# or (max(year(pr.submit_time)) = 2021 and max(month(pr.submit_time)) = 9)
group by er.uid
having (max(year(start_time)) = 2021 and max(month(start_time)) = 9)
or (max(year(pr.submit_time)) = 2021 and max(month(pr.submit_time)) = 9)
);