嘿,我正在尝试使用从子查询返回的结果来订购 SQL 查询,即
SELECT tb1.stud_id , tb1.stud_name , (SELECT sum(score) FROM scores WHERE student_id = tb1.
student) AS total_marks
FROM Students_info AS tb1
GROUP BY tb1.stud_id , tb1.stud_name
ORDER BY total_marks DESC
我也试过
ORDER BY (SELECT sum(score) FROM scores WHERE student_id = tb1.student) DESC
对此提供帮助将不胜感激。