排名
6
文章
6
粉丝
16
评论
8
{{item.articleTitle}}
{{item.blogName}} : {{item.content}}
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:
50010702506256


欢迎加群交流技术

--top not in方式 select top 条数 * from tablename where Id not in (select top 条数*页数 Id from tablename) --ROW_NUMBER() OVER()方式 select * from ( select *, ROW_NUMBER() OVER(Order by Id ) AS RowNumber from tablename ) as b where RowNumber BETWEEN 当前页数-1*条数 and 页数*条数 --offset fetch next方式 --SQL2012以上的版本才支持 select * from tablename order by Id offset 页数 row fetch next 条数 row only
分析:在数据量较大时
top not in方式:查询靠前的数据速度较快,不推荐not in
ROW_NUMBER() OVER()方式:查询靠后的数据速度比上一种较快,sql 2005以上可用
offset fetch next方式:速度稳定,优于前2种,sql2012及以上可用
欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739
评价