时间:2021-07-01 10:21:17 帮助过:20人阅读
二、方案
1、只有上一页和下一页(效率最高) a)、关键 记住这一页的最大值和最小值 b)、实现 max # 最大值 min # 最小值 下一页: select * from tb1 where id > max limit 10; 上一页 select * from tb1 where id < min order by id desc limit 10; 2、中间有页码 5, [6], 7, 8, 9 a)、关键 页码增量和当前页的最大值和最小值 b)、实质 max # 最大值 min # 最小值 n # 页码增量 下第n页: select * from tb1 where id in(select id from (select id from tb1 where id>max limit n*10) as B order by B.id desc limit 10); 上第n页: sleect * from tb1 where id in (select id from (select id from tb1 where id<min order by id desc limit n*10) as B order by B.id desc limit 10);
mysql 分页
标签:pre where bsp tween 连续 sel mysql weight sql