select a.uid,count(a.uid) as exam_complete_cnt from ( select uid,exam_id,start_time,submit_time,score, dense_rank() over(partition by uid order by DATE_FORMAT(start_time,'%Y%m') desc) rn --对各学生分组对考试月份按照最近时间排序 from exam_record )a where rn <=3 -- 选出最近三月 group by a.u...