数据库分页sql

select * from (
 select *,ROW_NUMBER() over (order by id) as rowNum
 from cw_diy_scene where category_id = @categoryId
) as tab
where tab.rowNum between (@currPage - 1) * @pageSize + 1 and @pageSize * @currPage

posted @ 2015-09-25 23:54  Thinker_cxz  阅读(102)  评论(0编辑  收藏  举报