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
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
欢迎关注我,一起进步!扫描下方二维码即可加我