SQL Server 2005 分页

    技术2022-05-20  45

    方法1

    select top 10 * from india1.tblSubAccessControl where id>=(select max(id) from (select top 20 id from india1.tblSubAccessControl order by id) as T) order by id --用时0.02164352+0.008310185

    方法2

    select top 10 * from india1.tblSubAccessControl where id between (select max(id) from (select top 20 id from india1.tblSubAccessControl order by id) as a) and (select max(id) from (select top 30 id from india1.tblSubAccessControl order by id) as b) order by id --用时0.02164352+0.02164352+0.008310185  

    方法3

    select * from (select ROW_NUMBER() over(order by id) as rownum ,* from india1.tblSubAccessControl) student where rownum between 20 and 29 --用时0.02164352  

    这三种方式都是比较常见的方法吧?用了之后我觉得性能方面:方法3>方法1>方法2


    最新回复(0)