分页2

--查询第八条至第十六条数据
--分页 ROW_NUMBER() OVER(ORDER BY orderID DESC) AS 字段编号
select title ,UnitPrice from(select title,UnitPrice, ROW_NUMBER() over(order by UnitPrice) as rowNumber from books) temp
where temp.rowNumber between 1 and 10
--页大小 7 第二页: 猪那个问题就是这个问题呗 少了个OrderBy
select top 10 title,UnitPrice from books where (id not in(select top 0 ID from books order by UnitPrice)
)order by UnitPrice--去后面数据 就是第二页 和 第三页 会出问题 因为有4个18元 用于都是取后后面开始计数 会有BUG

select top 10 title ,unitprice from books order by unitprice --前10条排序
select ID, title,unitprice from books order by unitprice

select id, title,unitprice from books
posted @ 2012-09-14 19:40  VoodooMax  阅读(115)  评论(0)    收藏  举报