sql分页代码

//三种sql分页语句

SELECT TOP 分页尺寸 *
FROM
(
SELECT ROW_NUMBER() OVER (ORDER BY id) AS RowNumber,* FROM Blobs
) A
WHERE RowNumber > 分页尺寸*(页数-1) SELECT TOP 分页尺寸 *
FROM Blobs
WHERE id NOT IN
(
SELECT TOP (分页尺寸 *(页数-1)) id FROM Blobs ORDER BY id
)
ORDER BY id select * from
(
select Row_Number() over (order by id) AS RowNumber,* from Blobs
) t
where RowNumber between 页数 * 分页尺寸+1 and (页数+1)*分页尺寸
上一篇:SQL分页查询结果不一致


下一篇:真正通用的SQL分页存储过程