Re: count function?
| From: | DC | Date: | Fri, 30 Mar 2001 19:33:50 +0000 |
| Subject: | Re: count function? | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-8047@lists.php.net to get a copy of this message | ||
Cheers Brian
Thats sounds more like i am looking for....
Although i have put the other code examples offered for this prob in my code
folder for later cause you never now when you'll need them.
Cheers
Dave C
""Brian S. Dunworth"" <brian@theprintinghouse.com> wrote in message
news:4.3.0.20010330142043.00b2bd80@smtp.postoffice.net...
> 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>
> -------------------------------------
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>