----每页2条记录,现在要获取第四页记录 : 先取出总共4页的记录,再排除前三页的记录
---需要: 每页的大小 ,要转入的页号,就可以了,效率较高
SELECT *
FROM (SELECT TOP 8 * FROM ORDERS ORDER BY orderId) as t1
WHERE orderId not in(SELECT top 6 ORDERId FROM ORDERs order by OrderId)
select * from orders
/*
方法2:
select * from ( select TOP pagesize * FROM ( SELECT TOP pagesize*cureentpage * from user_table
ORDER BY id ASC ) as aSysTable ORDER BY id DESC ) as bSysTable ORDER BY id ASC
*/
---sql 内部实现时,是先排序后取记录
---需要: 每页的大小 ,要转入的页号,就可以了,效率较高
SELECT *
FROM (SELECT TOP 8 * FROM ORDERS ORDER BY orderId) as t1
WHERE orderId not in(SELECT top 6 ORDERId FROM ORDERs order by OrderId)
select * from orders
/*
方法2:
select * from ( select TOP pagesize * FROM ( SELECT TOP pagesize*cureentpage * from user_table
ORDER BY id ASC ) as aSysTable ORDER BY id DESC ) as bSysTable ORDER BY id ASC
*/
---sql 内部实现时,是先排序后取记录