--获取总页码 pages
SELECT CEILING(COUNT(*)/25.0) AS ROWCOUN FROM cgddLabLE_tEMP WHERE ddrq='2013-06-29'
--当前页码page
--每页行数Size:15
-- 计算当前页的开始行和结束行 page-1*size+1,page*size
--第一页:0*15+1=1, 1*15=15
--第二页:1*15+1=16,2*15=30
--第三页:2*15+1=31,3*15=45
SELECT * FROM (
SELECT *,ROW_NUMBER() OVER (ORDER BY sid ) AS RowNum FROM cgddLabLE_tEMP WHERE ddrq='2013-06-29'
) t WHERE RowNum BETWEEN 31 and 45
SQL SERVER 分页
最新推荐文章于 2024-05-24 11:13:20 发布