SQL_CALC_FOUND_ROWS

  • Christian Stocker

Something I learned just now from Matthias Esken on his post on de.comp.lang.php.misc

SQL_CALC_FOUND_ROWS (available in MySQL 4.0.0 and up) tells MySQL to calculate how many rows there would be in the result set, disregarding any LIMIT clause. The number of rows can then be retrieved with SELECT FOUND_ROWS().

Maybe well know, but it was new to me (and comes very handy for calculating “total found results” for pagers and such without having to do 2 similar selects). More in the MySQL Manual.


Tell us what you think