我有一个简单的问题。我有这个表结构http://sqlfiddle.com/#!2/61cee/3/0,我只想计算每个攻击者的得分,然后从所有玩家和他的id中选择最高分。我试过这个:
SELECT MAX(counts), id_player FROM
(SELECT COUNT(score) AS counts, id_player
FROM fl_poll
WHERE position = 'attacker'
GROUP BY id_player) as maxi
但结果是错误的id。我在哪里做错了?感谢提前。