MySQL 统计语句怎么写

签到表
id   uid cs   create_time

cs: 签到次数 

每次签到向这个表添加一条数据
怎么统计出签到次数最多的前10个用户??

慕姐4208626
浏览 470回答 3
3回答

摇曳的蔷薇

select uid, sum(cs) as count from table1 group by uid order by count desc limit 10

有只小跳蛙

SELECT MAX(`cs`) FROM 表 group by id ORDER BY MAX(`cs`) DESC LIMIT 10 OFFSET 0

慕无忌1623718

SELECT uid FROM table GROUP BY uid ORDER BY count(id) DESC limit 10
打开App,查看更多内容
随时随地看视频慕课网APP