P粉8832782652023-08-29 09:48:52
FOUND_ROWS returns the number of rows returned by the previous request (the entire select statement). It sounds like you just want:
select count(1) from (select * From tipfirme limit 20) as T
select found_rows();
Used alone does not always return 1; I suspect you are not testing what you want to test. If it follows select * from tipfirme limit 20;
it does return the number of rows returned by the select (after limit, or before if you specified sql_calc_found_rows in the previous select
).
SELECT FOUND_ROWS() FROM (SELECT * FROM tipfirme LIMIT 20) as T
is not the result you want; it will return the same number of rows as the subquery returns, and each row There will be the number of rows returned by the previously executed select, regardless of the number of rows in the subquery.