sql语句添加一列标示,然后进行分页。

1  select id= IDENTITY(INT,1,1)  , sum(Score) as Score ,Student_NO,Student_Name
2 
3  into  #a2_tab
4  from ksy_stu_ScoreInfo GROUP BY  Student_NO,Student_Name  order by Score desc
5 
6   SELECT TOP (@Pagecount) * FROM #a2_tab WHERE id > (@byPage*@Pagecount);
7  DROP TABLE #a2_tab;
原文地址:https://www.cnblogs.com/ksy20151123/p/5391030.html