SQL查询语句中的 limit 与 offset 的区别:
比如分页获取数据:
第1页: 跳过0条数据,获取20条数据 (即1~20条)
select * from testtable limit 0, 20;
select * from testtable limit 20 offset 0;
第2页: 跳过20条数据,获取20条数据 (即21~40条)
select * from testtable limit 20, 20;
select * from testtable limit 20 offset 20;
第3页: 跳过40条数据,获取20条数据 (即41~60条)
select * from testtable limit 40, 20;
select * from testtable limit 20 offset 40;
[END]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)