August 2012 archive

MySQL: Get total number of rows when using LIMIT

A SELECT statement may include a LIMIT clause to restrict the number of rows return by the MySQL server. In some cases, it is desirable to know how many rows the SELECT statement would have returned without the LIMIT. To obtain the row count by include SQL_CALC_FOUND_ROWS option in the SELECT statement, and then execute …

Continue reading

Permanent link to this article: https://blog.openshell.in/2012/08/mysql-get-total-number-of-rows-when-using-limit/