现在用sqlserver 有 max 和 min 所以 ,能用到这种的情况下 可以提高查询速度,但是 用到的字段必须是不能重复。
这是我初步的了解,希望大家继续补充!
-------10 代表 要显示几条数据 ,这里显示 10 条数据,
------ max (rec_id) 代表 rec_id 的最大值
top ((125247-1)*10) ----- 这里注意: 我一共查处 1252475 条数据。 125247 =(1252475 / 10); 10 代表每页显示的条数。 1252475 这里 必须是 整数。
SELECT top 10 * from bck_fuka5
where
rec_id >
(select max (rec_id) from
(select top ((125247-1)*10) rec_id from bck_fuka5 order by rec_id) as T
) ORDER BY rec_id
- ----Oracle 分页
select * from
(select ROWNUM rn ,A.*
from (select * from LPA_PLAN_DTL) A
where ROWNUM <=10
)
where rn > 0