Reputation: 961
I have run following query on local system
SELECT FOUND_ROWS() FROM table_name LIMIT 1;
SQL Version : 5.6.16
It returns number of rows.
when same query run on server(SQL Version : 5.7.17) it return 0.
After searching on internet people suggest to use
SQL_CALC_FOUND_ROWS
so i have use following query on local and server as well.
SELECT SQL_CALC_FOUND_ROWS * FROM users
SELECT FOUND_ROWS();
But results are same it works fine on local(SQL Version : 5.8.16) and return 0 on server(SQL Version : 5.7.17).
Upvotes: 5
Views: 1175
Reputation: 373
This is a mysql bug that can be responsible for this issue, depending on which version you use:
http://bugs.mysql.com/bug.php?id=1468
You can workaround it by using a GROUP BY clause in your query. In my case it is working well.
Upvotes: 1