标签:
利用子查询示例:
SELECT * FROM your_table WHERE id <=
(SELECT id FROM your_table ORDER BY id desc LIMIT ($page-1)*$pagesize )
ORDER BY id desc LIMIT $pagesize
利用连接示例:
SELECT * FROM your_table AS t1
JOIN (SELECT id FROM your_table ORDER BY id desc LIMIT ($page-1)*$pagesize ) AS t2
WHERE t1.id <= t2.id ORDER BY t1.id desc LIMIT $pagesize;
count(1)就是count(1),这表明是求值。
count(*)变成了count(0),这表明是计算行数的。
标签:
原文地址:http://www.cnblogs.com/moss_tan_jun/p/5645159.html