MySQL数据库limit(分页)语句

select * from persons limit A, B;

解释:

A,查询起点

B,你需要的行数

示例:
select * from persons limit 0 , 4;
解释:
起点位置为0,开始查询,返回4条数据

String sql="select * from category limit "+(p-1)*Resource.PAGETOTAL+","+Resource.PAGETOTAL ;

这句话的作用是从category表中按每页为Resource.PAGETOTAL这个常量的数据显示。

发布了230 篇原创文章 · 获赞 250 · 访问量 28万+

猜你喜欢

转载自blog.csdn.net/weixin_42247720/article/details/103963047