数组未排序

问题描述 投票:0回答:1

如何获得按 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 )
mysql sorting sql-order-by
1个回答
0
投票

这样的东西应该有效。

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;
© www.soinside.com 2019 - 2024. All rights reserved.