在mysql中查找各种值总和的最大值 [英] Finding the maximum of various sum of values in mysql

查看:66
本文介绍了在mysql中查找各种值总和的最大值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表,其中的值如图所示

I have a table with values as shown

Player   ||   Match     ||   Score

 A              1               72
 B              1               55
 A              2              100
 C              1               90
 B              2              175

我想在此表中获得得分最高的球员姓名(他在所有比赛中的得分总和).

I wish to obtain the player name who has scored maximum runs(sum of his scores in all the matches) in this table.

如何在 mysql 中以有效的方式完成此操作

How can this be done in efficient way in mysql

谢谢

推荐答案

未验证:

select Player
from myTable 
group by Player
order by sum(score) desc
limit 1

这篇关于在mysql中查找各种值总和的最大值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆