带分页的sql语句

SELECT TOP {0} * FROM (
SELECT ROW_NUMBER() OVER (ORDER BY UpdatedDate desc) AS RowNumber,* FROM [表名] Where (1=1)  and (其他条件)
) A WHERE RowNumber > {0}*({1}-1)

 

{0}:PageSize每页条数

{1}:PageIndex当前页码(1开始)

posted @ 2017-08-29 10:39  齐大齐  阅读(218)  评论(0编辑  收藏  举报