sql

declare @PageIndex as int
declare @PageSize as int
set @PageIndex = 1
set @PageSize = 10

SELECT *
FROM 
(SELECT ROW_NUMBER() OVER (ORDER BY id DESC)AS Row, * FROM user) as list
WHERE Row between (@PageIndex - 1) * @PageSize + 1 and @PageIndex*@PageSize 

你可能感兴趣的:(sql)