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
原文:http://www.cnblogs.com/thinker-cxz/p/4839800.html