UPDATE:FOUND_ROWS()函数貌似还存在一些问题,见http://bugs.mysql.com/bug.php?id=18454
mysql 4.1中新增了FOUND_ROWS()函数,这个函数的说明是这样的:
For a SELECT with a LIMIT clause, the number of rows that would be returned were there no LIMIT clause
A SELECT statement may include a LIMIT clause to restrict the number of rows the server returns to the client. In some cases, it is desirable to know how many rows the statement would have returned without the LIMIT, but without running the statement again. To obtain this row count, include a SQL_CALC_FOUND_ROWS option in the SELECT statement, and then invoke FOUND_ROWS() afterward:
阅读全文(763字)