# 二个表的数据 如何做分页？

``````select * from t_日志表 order by create_time desc limit 0,10

select * from t_说说表 order by create_time desc limit 0,10``````

``````select * from t_日志表 order by create_time desc limit 9,10

select * from t_说说表 order by create_time desc limit 9,10``````

``````select * from t_日志表 order by create_time desc limit 100

select * from t_说说表 order by create_time desc limit 100``````

(这里假设查询一直只往后查询，前面查询的数据都保存在客户端了 )

``````select * from t_日志表 where create_time< createTime  order by create_time desc limit 0,10

select * from t_日志表 where create_time< createTime  order by create_time desc limit 0,10``````

``select count(*) from t_日志表  + select count(*) from t_说说表``

``````List<Object> objectList = new ArrayList<>(说说数组.size()+日志数组.size());

objectList.sort((obj1,obj2) ->{
Date createTime1 = null;
Date createTime2 = null;
try {
Field field1 = obj1.getClass().getDeclaredField("createTime");
field1.setAccessible(true);
onlineTime1 = (Date)field1.get(obj1);

Field field2 = obj2.getClass().getDeclaredField("createTime");
field2.setAccessible(true);
onlineTime2 = (Date)field2.get(obj2);

} catch (Exception e) {
e.printStackTrace();
}
boolean after = createTime1.after(createTime2);
return after ? 1 : -1;
});``````

原文作者：深圳市热心市民市民
原文地址: https://blog.csdn.net/u013107634/article/details/86693477
本文转自网络文章，转载此文章仅为分享知识，如有侵权，请联系博主进行删除。