我的SQL查询
select *
from (
select *
from (
select b.course_code currentc
, b.pre_reqcoursecode prec
from (
select course_code
, pre_reqcoursecode
from adss_PreReqCourses
) a
join adss_PreReqCourses b
on a.course_code=b.course_code
where b.course_code='EE218'
) F
join adss_CoursesResult w
on F.prec=w.course_code
where w.GradePoint='B'
) J
join adss_CoursesResult I
on J.currentc=I.course_code
group by I.GradePoint
;
输出:
GradePoint Predicted
C+ 24628
C 22372
B- 18424
现在如何获得具有最高预测计数的等级点?
答案 0 :(得分:3)
这适用于SQL Server(因为你说你使用的是Visual Studio 2012,很可能):
SELECT TOP 1 *
FROM (/*Your Query Here*/) A
ORDER BY Predicted DESC
答案 1 :(得分:0)
更改行
select *
到
select top 1 *
并添加最后一行
order by Predicted desc