------解决方案-------------------- select sum(x) from (select max(col) as x from t) a;
------解决方案--------------------
------解决方案-------------------- 分组错误,sum是分一组,max是分好几组(按你的意思),不一致,应该为select sum(m) from (select max(..) m from ..);
------解决方案-------------------- sum(max(score))
select sum(ms) from ( select username,max(score) as ms from tb group by username )T