Knowledge Walls
John Peter
Pune, Maharashtra, India
How to get mysql get total record count with limit?
3563 Views
Mysql FOUND_ROWS() method is used to get what SQL_CALC_FOUND_ROWS in the SELECT query returns. SQL_CALC_FOUND_ROWS name after the SELECT which returns Query rows/record count not limit countt.

Example
SELECT SQL_CALC_FOUND_ROWS * from USER_INFO WHERE 1 LIMIT 0,10;
SELECT FOUND_ROWS();
Example Found_Rows() method in Mysql
SELECT SQL_CALC_FOUND_ROWS * from USER_INFO WHERE 1 LIMIT 0,10;
SELECT @result_count := FOUND_ROWS();
@result_count returns 
256

256 is a user_info record count.
Note: Don't run both queries seperately.
Best Lessons of "One day One Thing to Know"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details