with new as (select uid, exam_id, times, row_number() over (partition by uid order by times) rk from (select uid, exam_id, date_format(start_time, '%Y-%m-%d') times from exam_record where year(start_time) = 2021 group by uid, exam_id, date_format(start_time, '%Y-%m-%d') ) t ) select uid, days_win...