取总数: Select SQL_BUFFER_RESULT count(id) as all_ID from my_tab 总页数: 总数/每页条数 最后一页的条数: 总数%每页条数
查询数据: select id,title,price from my_tab m INNER JOIN ( select id as my_id from ( select id from my_tab order by id desc limit 100,100 ) as tmp ) as temp ON my_id=id
第一步、按照最快原则,以主键id作为条件排序 ( select id from my_tab order by id desc limit 100,100 ) as tmp
第二步、按照最少原则,只取回当前所需的记录,而且只取id ( select id from my_tab order by id desc limit 100,100 ) as tmp
第三步、按照最快原则,以主键id作为条件取回所需的信息 select id,title,price from my_tab m INNER JOIN ( ... ) as temp ON my_id=id