复杂程度不如之前那条中等题目

**题目的测试用例似乎并不是很严谨。下边的版本只是有在2021年9月活跃过的,但提交通过了**
select u.uid,nick_name,achievement	from  user_info u left join (
select uid,start_time from exam_record
union all 
select uid,submit_time from exam_record
union all 
select uid,submit_time from practice_record) a  #组合两张表,将时间汇总。
on u.uid=a.uid
where achievement between 1200 and 2500
and nick_name like '牛客%号'
and start_time like '2021-09%'
group by u.uid,nick_name

稍微调整下将条件移到having即可。
select u.uid,nick_name,achievement	from  user_info u left join (
select uid,start_time from exam_record
union all 
select uid,submit_time from exam_record
union all 
select uid,submit_time from practice_record) a 
on u.uid=a.uid
where achievement between 1200 and 2500
and nick_name like '牛客%号'

group by u.uid,nick_name
having max(start_time) like '2021-09%'