其实这里有一个关键就是对于<br>Lession(lessions nvarchar(50),score int) 获得任意的所有学科的前几名,其实只要对每一个科的分数给它排一个序就完事了 代码如下<br>select Liessions,Score,(select count(*) from <br> (select distinct * From Lession)xx <br> Where xx.Liessions=yy.Liessions <br> And xx.Score>=yy.Score) as tmd<br>From(select distinct Liessions,Score From T_Score) yy