Max of sum query

前端 未结 5 1894
天涯浪人
天涯浪人 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-27 10:00

    You may want to tackle this by just using the group by and Sum(), and retrieve the result with an order by sum() with limit 1 or more depending on how many students your want.

    This would eliminate the outer subquery.

提交回复
热议问题