0

我的 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

现在如何获得预测计数最高的成绩点?

4

2 回答 2

3

这适用于 SQL Server(因为您说您使用的是 Visual Studio 2012,所以很可能):

SELECT TOP 1 *
FROM (/*Your Query Here*/) A
ORDER BY Predicted DESC
于 2013-04-23T17:38:14.580 回答
0

换线

select *

select top 1 *

并添加最后一行

order by Predicted desc
于 2013-04-23T17:41:03.287 回答