RE: [PHP-DB] count function?

From: Date: Fri, 30 Mar 2001 19:24:30 +0000
Subject: RE: [PHP-DB] count function?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-8046@lists.php.net to get a copy of this message
At 10:06 AM 3/30/01 -0800, Larry Rivera wrote:
I think you have to run multiple queries, ie run some loop after finding out what topics you wil count from e==> run a select distinct to get the topics run a while or for loop then run queries again like count(*) where topic='$topic'
Better yet (and less db-intensive), run a SELECT TOPIC,COUNT(*) FROM table_name WHERE condition GROUP BY TOPIC ORDER BY COUNT(*); That'll return:
 TOPIC    COUNT(*)
-------- --------
 Topic A         8
 Topic B         3
 Topic C         1
 Topic D         0
 Topic E         0
------------------------------------- Brian S. Dunworth Sr. Software Development Engineer Oracle Database Administrator The Printing House, Ltd. (850) 875-1500 x225 <brian@theprintinghouse.com> -------------------------------------

« previous php.db (#8046) next »