I have a nice little query that I can get the results from fine, but am
having problems figuring out the best way to get the count directly from
mysql. The query looks like the following:
SELECT t1.id, t1.col1, t2.id, t2.col1, t2.col2, t2.col3, t2.col4 FROM t1
JOIN t2 ON ( t2.id = t1.col1 )
-Original Message-
From: Les Fletcher [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 01, 2007 3:27 PM
To: mysql@lists.mysql.com
Subject: counting on a complex query
I have a nice little query that I can get the results from
fine, but am
having problems figuring out the best way to get
On 8/1/07, Jerry Schwartz [EMAIL PROTECTED] wrote:
Will SELECT SQL_CALC_FOUND_ROWS and SELECT FOUND_ROWS() do what you want?
Be careful. While it will give the correct number of rows that would
have been found if LIMIT had not been used, it makes the server
compute the whole result set,
SQL_CALC_FOUND_ROWS isn't an option for us. Right now I am doing two
queries, but I am just trying to see if there is a better way to do the
count query than to just turn it into a dervied table and count the
results i.e. SELECT COUNT(*) FROM (big nasty query) t1.
I think what the question
On 8/1/07, Les Fletcher [EMAIL PROTECTED] wrote:
SQL_CALC_FOUND_ROWS isn't an option for us. Right now I am doing two
queries, but I am just trying to see if there is a better way to do the
count query than to just turn it into a dervied table and count the
results i.e. SELECT COUNT(*) FROM