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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to