分页排序的SQL查询语句

T-SQL语句:

select * from (select row_number() over(order by id) as idx, T_A.* from T_A) as T_B where T_B.idx between (PageNum-1)*PageCount and (PageNum-1)*PageCount

eg:select * from (select ROW_NUMBER() over(order by ID) as idx,dbo.客户.* from dbo.客户) as b where b.idx between 1*10 and 2*10

posted @ 2010-12-31 11:42  cosa7  阅读(326)  评论(0)    收藏  举报