Max of sum query

前端 未结 5 1971
天涯浪人
天涯浪人 2021-01-27 09:48

I\'m trying to write a query that will list student(s) enrolled with the maximum total credit points.

Here is my query:

    SELECT s.S_ID,
       s.S_LAS         


        
5条回答
  •  执念已碎
    2021-01-27 09:58

    Naughty double posting of the same question! This is the answer I gave to your other posting, same thing still applies here.

    I'm pretty sure (no Oracle machine to test this) that your alias is the problem:

    sum(q1.CREDITS) Total Credits
    

    Should be

    sum(q1.CREDITS) "Total Credits"
    

    And therefore

    max( q3.Total Credits)
    

    Should be

    max( q3."Total Credits")
    

    Or you could get rid of the space in the alias. But there may be more to it than that, as I say, I've no Oracle machine handy to test that out.

提交回复
热议问题