答案 0 :(得分:2)
这将给你第二高分
Select
(SELECT MAX(Marks) FROM Marks
WHERE Marks NOT IN
(SELECT MAX(Marks) FROM Marks)) AS 'Second Highest'
from Marks
答案 1 :(得分:0)
WITH MarksCTE AS ( 选择DENSE_RANK()OVER(PARIDTION BY CourseID ORDER BY Marks desc)作为Rank,m.Marks,c.Name作为Course,s.Name作为Student 从马克斯出发 内部加入学生作为S.Id = M.StudentID 内部加入课程为c.Id = M.CourseID ) 从MarksCTE中选择Marks,Course,Student,Rank = 2