You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LIMIT limits the number of rows returned by the query (no limit if null or smaller than zero). OFFSET specified how many rows to skip.
SELECT * FROM t_person WHERE age>18 LIMIT 2 OFFSET 2
跳过2条, 取2条
不就是第二页的2条记录吗?
调试发现对于数据库H2,执行分页代码,第一页的时候:List peoplepage = dao.query(Person.class, Cnd.where("age", ">", 18), dao.createPager(1, 2));
日志打印:"SELECT * FROM t_person WHERE age>18 LIMIT 2 OFFSET 0 "
第二页的时候:
List peoplepage = dao.query(Person.class, Cnd.where("age", ">", 18), dao.createPager(2, 2));
日志打印:"SELECT * FROM t_person WHERE age>18 LIMIT 2 OFFSET 2"
明显跳过了 OFFSET 1 ,测试数据后发现,确实当中有数据一页数据跳过。
可否解释下?
The text was updated successfully, but these errors were encountered: