select t.date, t.user_id, t.pass_count from (select date, user_id, pass_count, row_number() over(partition by date order by pass_count desc) as pass_rank from questions_pass_record) t where t.pass_rank < 3 order by t.date,t.pass_count desc