Re: selecting count and then dumping to an array
| From: | Peter Goggin | Date: | Sat, 07 Jun 2003 13:31:55 +0000 |
| Subject: | Re: selecting count and then dumping to an array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-150578@lists.php.net to get a copy of this message | ||
Try
select type, count(*) from table group by type;
This should return a count for each distinct type value.
Regards
Peter Goggin
----- Original Message -----
From: "Ryan A" <ryan@jumac.com>
To: <php-general@lists.php.net>
Sent: Sunday, June 08, 2003 12:13 AM
Subject: [PHP] selecting count and then dumping to an array
> Hi,
>
> Is there any way to get a COUNT of records (SELECT count(*) FROM main_my
> where type=$t) for 5 types using hopefully one select statement and then
> dumping that into an array?
>
> The reason I am asking is running 5 selects on the DB at once is not a
very
> good idea...right?
>
> Thanks,
> -Ryan
>
> http://MrSahaf.com - The Iraqi (Dis)information ministers site
> ("We will
> slaughter you all!")
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>