问题拆解 求出每个人做题的时间差,并精确到秒:timestampdiff(second, start_time, submit_time) 按照卷子的类型将完成时间排序,并找到第二名和倒数第二名,因此可以正序和倒序排两次:row_number() over(partition by er.exam_id order by timestampdiff(second, start_time, submit_time) desc) as ranking1, 正序的为ranking2;之后筛选ranking1或者ranking2找到对应的行 表格...