#活跃时间
with a as(
    select uid,max(dt) as latest
    from(
    select uid,date_format(start_time,'%Y%m') as dt from exam_record
    union 
    select uid,date_format(submit_time,'%Y%m') as dt from practice_record)b
    group by uid
    having latest ='202109'
)

select uid,nick_name,achievement
from user_info ui

where nick_name like '牛客%号'
and achievement between 1200 and 2500
and uid in (select uid from a)

简单