sql分页逻辑top是最快速的

 

-- 用top分页是最快速的分页查询方式
-- (PageIndex - 1) * PageSize+1
--PageIndex=1  PageSize=10  key=autoid  TableName=customers


select top      10 *  from  customers
where [autoid] >=(select max([autoid]) from (
select top       ((2 - 1) * 10+1) [autoid] from  customers
where 1=1  
) as tempTableName) 

 

posted on 2018-11-20 15:21  苏上话  阅读(789)  评论(0编辑  收藏  举报