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
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
Thanks guys,
will give it a shot and write back if i have any problems.
Cheers,
-Ryan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
building on the only reply that I saw try this also.
Say you had 12 different TYPE's that are in your table, and you only wanted
5 of them.
Then you will want something like what follows.
SELECT type, count(*) FROM table WHERE type='$1' OR type='$2' OR \
type='$3' OR
4 matches
Mail list logo