日期:2014-05-16  浏览次数:20968 次

基于SQL2000的系统,一般都使用存储过程分页,翻到哪一页只获取那一页的记录。而不是全读,可以提高效率。 如果我现在使用ACCESS数据库
基于SQL2000的系统,一般都使用存储过程分页,翻到哪一页只获取那一页的记录。而不是全读,可以提高效率。       如果我现在使用ACCESS数据库,如何做到呢??

------解决方案--------------------
自己用select top 的嵌套处理。

--第11条到第30条,共选出20条记录
select *
from (select top 20 * from (select top 30 * from 表名 order by ID) t1 order by ID desc) t2
order by ID


--第11条到第30条,共选出20条记录
select top 20 *
from 表名
where ID> (select max(ID) from (select top 10 ID from 表名 order by ID) t1)
order by ID