0
需要得到內部連接等級的最大值的幫助。如何用3個內連接獲得最大值?
代碼:
SELECT StudFirstName, StudLastName, sc.ClassID, sub.SubjectID, sub.CategoryID, Grade
FROM SS_Students as st INNER JOIN SS_Student_Schedules as ss
ON st.StudentID = ss.StudentID
INNER JOIN SS_Classes as sc
ON ss.ClassID = sc.ClassID
INNER JOIN SS_Subjects as sub
ON sc.SubjectID = sub.SubjectID;
只需要獲得甲級最高值,因此產量將下降縮短1行。
您可以使用'SELECT MAX(年級)FROM ...' –
@Nish Patel您只想要最大值,或者您想要完整的詳細信息,哪個學生獲得最高等級和主題詳細信息? –
ORDER BY grade DESC LIMIT 1;否則,請參閱https://meta.stackoverflow.com/questions/333952/why-should-i-provide-an-mcve-for-what-seems-to-me-to-be-a-very-simple-sql - 查詢 – Strawberry