关键字: sql server, 查询中间, 分页
每页显示5条数据,查询第二页,也就是查询第5条到第10条数据
select top 页大小 *
from table1
where id>
(select max (id) from
(select top ((页码-1)*页大小) id from table1 order by id) as T
)
order by id
本文详细介绍了如何在SQL Server中实现分页查询,通过使用动态SQL和子查询,可以高效地获取特定页码的数据范围,例如获取第5条到第10条数据。
select top 页大小 *
from table1
where id>
(select max (id) from
(select top ((页码-1)*页大小) id from table1 order by id) as T
)
order by id
4209

被折叠的 条评论
为什么被折叠?