1: 从数据库中选取第 20-30 项
select * from newslist limit 20,10;
2: 从数据库中选择符合条件的数据表. 并按照 htmlid 进行逆序排放
- select * from newslist where id=1 and pid=1 order
- by htmlid desc
3: 将符合条件的数据表逆序排放之后, 选择第 20,30 项, 也就是原数据库 的倒数第 20-30 项
- select * from (select * from newslist where id=1 and pid=1 order
- by htmlid desc)t1 limit 20,10;
来源: http://www.bubuko.com/infodetail-2610381.html