MySQL Forums
Forum List  »  Newbie

Re: Probably v. simple-Determining total rows while using LIMIT?
Posted by: Russell Dyer
Date: June 24, 2005 10:26PM

You need to add the SQL_CALC_FOUND_ROWS flag to your SELECT statement. It goes after the keyword SELECT and before the column names like so:

SELECT SQL_CALC_FOUND_ROWS col1, col2
FROM table1 LIMIT 25;

The results of the SQL statement will be the same. However, if you run the following statement, it will return a results set containing the number of rows that met the criteria of the previous statement:

SELECT FOUND_ROWS();

Russell Dyer

Author of "MySQL in a Nutshell" (O'Reilly 2005).

Options: ReplyQuote


Subject
Written By
Posted
Re: Probably v. simple-Determining total rows while using LIMIT?
June 24, 2005 10:26PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.