SQL2008--行号的得到
WITH DataTable AS( select *, ROW_NUMBER() OVER(order by ID) as Rowno from (select * from UserInfo) as TempTable) select * from DataTable where Rowno between 2 and 5
或着
WITH OrderedOrders AS ( SELECT *, ROW_NUMBER() OVER (ORDER BY ID) AS 'RowNumber' FROM UserInfo ) SELECT * FROM OrderedOrders WHERE RowNumber BETWEEN 50 AND 60
作者:疯狂Delphi
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
欢迎关注我,一起进步!扫描下方二维码即可加我
![](https://images.cnblogs.com/cnblogs_com/FKdelphi/1101510/o_200417075318%E5%8A%A0%E6%88%91QQ.jpg)
![](https://images.cnblogs.com/cnblogs_com/FKdelphi/1101510/o_200417080925%E5%8A%A0%E6%88%91%E5%BE%AE%E4%BF%A1.jpg)