Efficient way to count rows when using GROUP BY

From: Date: Sun, 26 Jun 2005 10:39:50 +0000
Subject: Efficient way to count rows when using GROUP BY
Groups: php.db 
Request: Send a blank email to php-db+get-39769@lists.php.net to get a copy of this message
Hi All, I use SELECT COUNT(*) FROM whatever WHERE whatever to determine how many rows a particular query will return (then use this count to assist with pagination). The problem is that this does not work if the query contains a GROUP BY statement as, of course, the query will return many rows each with a count by each grouping. Does anyone know an efficient way to determine the number of ROWS a query with a GROUP BY statement will return (without just executing the entire query with no LIMIT statement)? Thanks ... Ross

« previous php.db (#39769) next »