最里层:查询出前50010条数据,使用row_number() over 语法,增加一个n字段,代表该条数据时第几行,同时查出我们想要的信息,这里跟其他方法一样查询出所有:*。
最外层:根据where...来匹配n,同时直接拿出 n>50000 且 n<50010 行的数据。
SQL代码:
< | < (因为在xml配置文件中小于符号会被转义报错 Tag name expected ) |
index | 前台传的当前页数 |
size | 一页多少条数据 |
select * from
(
select *,row_number() over
(
order by
time desc
) n
from history (这里可以添加你想要的where条件)
) hhh
where hhh.n > ${(index-1)*size}
and hhh.n <= ${index*size}