FOUND_ROWS()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns the number of rows found by the most recent successful SELECT
statement.
USAGE
FOUND_ROWS()
DETAILS
FOUND_ROWS()
is an information function that returns the number of rows found by the most recent successful SELECT
statement even if a LIMIT
clause did not return all of the row contents.
If the prior SELECT
had a LIMIT
clause, it must also have included the SQL_CALC_FOUND_ROWS
modifier for the return value of FOUND_ROWS()
to be correct.
EXAMPLES
CREATE table found_rows_example (a INT);
INSERT INTO found_rows_example VALUES (1), (2), (3);
SELECT SQL_CALC_FOUND_ROWS *
FROM found_rows_example
LIMIT 1;
+------+
| a |
+------+
| 1 |
+------+
SELECT FOUND_ROWS();
+--------------+
| FOUND_ROWS() |
+--------------+
| 3 |
+--------------+