Getting An Inventory Product Count

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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]




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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux