|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
hi to all
I use this query SELECT SQL_CALC_FOUND_ROWS * FROM prods LIMIT 100,10; I'd like to know how many rows this query returns without limit, but using this select FOUND_ROWS(); the result is everytime 1 You know why? No other query are processed before the found_rows(). Thanks -- Andrea |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Not an answer to your question, but I figured that I'd try and run it
on my server... here is my results. I'm using: mysql Ver 12.22 Distrib 4.0.24, for pc-linux-gnu (x86_64) I ran all of these queries in this exact sequence: If I run 'select * from client;' I get 264 rows If I run 'select found_rows();' I get the correct value of 264 If I run 'select * from client limit 100,10;' I will get 10 rows If I run 'select found_rows();' I erroneously get 110 So I guess its pretty much broken... I'll stay away from it! Jeach! |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
You haven't use the SQL_CALC_FOUND_ROWS.
In the manual you can find "If the preceding SELECT statement does not include the SQL_CALC_FOUND_ROWS option, then FOUND_ROWS() may return a different result when LIMIT is used than when it is not." If you can, try with this option. p.s. i use on my server mysql 5.0.18 -- Andrea |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
mmmhhhh
I ran the queries using the MySQL Query Browser software (http://www.mysql.com/products/tools/query-browser/) and the result of found_rows was 1. I ran the two queries above in a php page and the count of rows was correct. I have lost many time for this problem ![]() -- Andrea |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
mmmhhhh
I ran the queries using the MySQL Query Browser software (http://www.mysql.com/products/tools/query-browser/) and the result of found_rows was 1. I ran the two queries above in a php page and the count of rows was correct. I have lost many time for this problem ![]() -- Andrea |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
mmmhhhh
I ran the queries using the MySQL Query Browser software (http://www.mysql.com/products/tools/query-browser/) and the result of found_rows was 1. I ran the two queries above in a php page and the count of rows was correct. I have lost many time for this problem ![]() -- Andrea |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
andrea azzini wrote:
> I ran the queries using the MySQL Query Browser software > (http://www.mysql.com/products/tools/query-browser/) > and the result of found_rows was 1. MySQL Query Browser opens a new connection for each statement you execute. The value returned by FOUND_ROWS() is relevant only during the current connection. So there is no way to use this function in MySQL Query Browser; you must use the command-line tool 'mysql'. FWIW, the same issue happens when trying to use other session-dependent features in MySQL Query Browser, such as LAST_INSERT_ID() and user variables. Regards, Bill K. |
|
![]() |
| Outils de la discussion | |
|
|