select uid,level,register_time,max_score
from(
select t3.uid,level,register_time,max(score) max_score,row_number() over(order by max(score) desc) rankk
from user_info t3
left join exam_record t4
on t3.uid = t4.uid
where t3.uid in(
select t1.uid
from user_info t1
left join exam_record t2
on t1.uid = t2.uid
where t2.exam_id in(
select exam_id
from examination_info
where tag = "算法"
)
and t1.job = "算法"
and date(t1.register_time) = date(t2.submit_time))
group by uid) t5
where rankk between 7 and 9
先选id,之后根据先where再group by再窗口函数的顺序进行作答

京公网安备 11010502036488号