|
|||||||
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
How to determine the number of rows in the full result set and also restrict the number of rows that a query returns,without running a second query ?
Most of the developers using 2 queries to find total number of rows and limit,when we need pagination(1,2,3,4). why should we write 2 queries to find limit as well as total number of rows in a table. we can achieve this in a single query. eg: SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name WHERE id > 567 LIMIT 10; So SQL_CALC_FOUND_ROWS can be useful in situations when you want to restrict the number of rows that a query returns, but also determine the number of rows in the full result set without running the query again.
__________________
website worth calculator |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|