1.采用limit关键字进行分页
select * from table order by id asc limit 100,20
2.使用top关键字
select top 20 * from table where id not in(select top 100 from table order by id asc)order by id
3.使用大于或者小于条件
select * from table where id > 100 order by id limit 20
本文介绍了三种SQL分页方法:利用LIMIT关键字实现简单分页、通过TOP关键字结合子查询完成复杂分页以及使用大于或小于条件进行高效分页。
1.采用limit关键字进行分页
select * from table order by id asc limit 100,20
2.使用top关键字
select top 20 * from table where id not in(select top 100 from table order by id asc)order by id
3.使用大于或者小于条件
select * from table where id > 100 order by id limit 20
461

被折叠的 条评论
为什么被折叠?