Summary Report With Details - Newbie Question
| From: | revDAVE | Date: | Fri, 13 Mar 2009 22:29:00 +0000 |
| Subject: | Summary Report With Details - Newbie Question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-290023@lists.php.net to get a copy of this message | ||
Hi Folks,
I would like to make a summary report with details for a products inventory
list - so it could list:
A - the product & a few summaries like total count on 1 line
B - ------- below that: the details of a multi line sub list with inventory
data like:
A - PRODUCT #1 - count = 25
B ---------- id 56 - condition = good
------------ id 98 - condition = new
A - PRODUCT #2 - count = 18
B ---------- id 205 - condition = new
------------ id 381 - condition = poor
and repeat for all inventory products....
-----
The way I'm doing it now is :
main query #1
SELECT name,model, count(prid) as thecount FROM inventory group by model
then do a repeat region table to display 1 of each
- then - on each row - do sub query#2 :
SELECT name,model, condition (etc....) FROM inventory where model =
quety#1.model....
- then display these details in a sub table....
Q: This seems to work fine. I was just wondering if there is a better way to
construct queries to get the same result?
Thanks in advance for your help...
--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]