统计评论量最高的十个老师的评论总量

这张teacher__comment表里面老师们有不同的ID,怎么统计排名前十的老师的评论总量

前十名老师的总量不是10么?

top 10 可以获取前十,sum聚合函数求和

这么写应该可以吧:select sum(pinglun) from (select top 10 from (select count(评论) from teacher_comment order by id))

看不到你的表结构
大概是
select count(*) from table where teachid in (select top 10 teachid from table order by topic)

select sum(cnt) from (select top 10 ID, count(1) AS cnt from teacher_comment group by ID order by count(1) desc)