MySQL Forums
Forum List  »  Newbie

Re: Counting number of rows return from count(*)
Posted by: Jay Pipes
Date: June 27, 2005 02:49PM

Sorry, you need 4.1+ to use derived tables/subqueries.

You'll have to do:

CREATE TEMPORARY TABLE tmp_count
SELECT count( * )
FROM `4images_sessions_hist` sh
WHERE sh.session_user_id <> -1
GROUP BY FROM_UNIXTIME( sh.session_lastaction, '%Y-%m-%d %H' ) , sh.session_user_id, sh.session_ip;

SELECT COUNT( * ) AS rows FROM tmp_count;

DROP TABLE tmp_count;

Jay Pipes
Community Relations Manager, North America, MySQL Inc.

Got Cluster? http://www.mysql.com/cluster
Personal: http://jpipes.com

Options: ReplyQuote


Subject
Written By
Posted
Re: Counting number of rows return from count(*)
June 27, 2005 02:49PM


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.