Getting An Inventory Product Count
| From: | revDAVE | Date: | Fri, 27 Feb 2009 16:17:23 +0000 |
| Subject: | Getting An Inventory Product Count | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-288928@lists.php.net to get a copy of this message | ||
Newbie question
Hi folks,
Currently, I have an inventory table that stores individual records for each
single item in inventory - ( each item is on its own line because it has
serial numbers associated with it) like:
fields:
Item - ModelID - sn
item1 - 1 - sn xxx
item1 - 1 - sn xxx
item2 - 2 - sn xxx
item2 - 2 - sn xxx
item2 - 2 - sn xxx
item3 - 2 - sn xxx
Goal: I would like to give a report page with total counts for current in
inventory like:
COUNTS...
item1 = 2
item2 = 3
item3 = 1
so I created a fool around query that gets a count for just ModelID = 1
$query_count_model1 = "SELECT count(inventory_id) as thecount FROM inventory
WHERE ModelID = 1";
BUT: - the I'm sure there is some better way to get a count for *each* of
the ModelID that exist in any given time *all at once* in some kind of loop
or xxx???... I just don't know how do that...
(newbie alert) - I would appreciate any ideas or URL links etc. - please
keep is simple for this newbie....
--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]