表结构和数据如下,我需要查询uid的total之和最大的前10条数据,请问sql语句如何写
uid total 1 4 2 1 2 2 3 6 1 5 4 9
认证高级PHP讲师
SELECT uid, SUM( total ) FROM `test` GROUP BY uid ORDER BY SUM( total ) DESC LIMIT 0 , 10
认证高级PHP讲师