Working on a Subsummary Report

[xpost ]Hi all,

I need to create a year to date report with individual Subsummary
Report (ala filemaker / others?) headings for each month. So, I’m
curious the best way to approach this for performance speed and
flexibility etc.

  • I can do 1 sql query for the whole year’s data - or 12 individual
    queries… probably best to do 1 big year sql query - but I’m not sure
    how to split things up with loops etc.

each summary month heading will need to show:

  • total month count of records
  • special counts within each month
  • more stuff
  • also the record data

like:

JAN - total record count = 50 special count = 3

data record 1
data record 2
data record 3

FEB - total record count = 47 special count = 4

data record 1
data record 2
data record 3
etc.

Q: is it better to do 1 year find or 12 month queries - is 1 big find faster?

Q: with one year find - how do I setup 12 loops to simulate summaries?
do i just loop through the full set and only display if record is in
month 1 or 2 or whatever?

If there are any links describing this process - that would be great


beginner question - what would we call this type of query/display:

reporting or summary or ? I’m not sure what terms look up?

it would be similar to query all categories and their products sold in a year and display like:

summary heading1
CAT 1
sub head 1------- Prod 1

----------- sales prod data 1
----------- sales prod data 2 etc

sub head 2------- Prod 2

----------- sales prod data 3
----------- sales prod data 4 etc

summary heading2
CAT 2
sub head 3------- Prod 3

----------- sales prod data 5
----------- sales prod data 6 etc

any other hints will help a lot…

also while I am testing I am trying to loop through the query 2 times

table 1

i tell it to show records if they meet criteria 1

then do again in table 2

table 2

i tell it to show records if they meet criteria 2

but the table 2 only shows 1 record

like the query number needs to be reset - but how?

like---- 2x …

<?php do { ?> <?php if ($row_get1['loc'] = 'back') { ?>
<tr>
  <td><?php echo $row_get1['id']; ?></td>
  <td><?php echo $row_get1['loc']; ?></td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
</tr>
<?php }; ?>
<?php } while ($row_get1 = mysql_fetch_assoc($get1)); ?>
Sponsor our Newsletter | Privacy Policy | Terms of Service