Sql 分页语句

/**分页SQL**/
SELECT ROW_NUMBER() OVER(ORDER BY ID DESC) AS rowIndex,* from TableName where rowIndex BETWEEN @PageIndex AND @PageSize

 

select * from (select *,ROW_NUMBER()over(order by [ID]) as rowindex from product ) tb  where rowindex between " + ((pageIndex - 1) * pageSize + 1) + " and " + pageIndex * pageSize

 

 

--关键语句:--

ROW_NUMBER()over(order by [ID]) as rowindex

posted @ 2019-09-12 11:23  罪後忆支湮  阅读(151)  评论(0编辑  收藏  举报