数据库中的表
id
1
2
4
30
31
...
分页
per page is 2 row, desc.
如果我有id = 30
如何知道哪个页码?
任何建议将不胜感激
答案 0 :(得分:0)
首先得到它的命令:
select count(*) from table_name where id <= 30 order by col_name;
然后图页码:
int order = 27; // the result from previous query,
int pageSize = 10;
int pageNum = order/pageSize + (order%pageSize==0?0:1); // here page number start from 1, not 0,