如何获得按 a.id、a.exam、a.question 排序的表格
select * from(
(select * from responses order by id, exam, question) a
left JOIN
(select max(exam) as maxexam from responses) b
on a.exam <= b.maxexam
and a.id > 2 )
这样的东西应该有效。
SELECT * FROM responses a
LEFT JOIN (SELECT MAX(exam) as maxexam FROM responses) b
ON a.exam <= b.maxexam AND a.id > 2
ORDER BY a.id, a.exam, a.question;