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:


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: 

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]

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to