I have the following task:
I have many equal tables of different people (>500) which contain working hours. The following is a sample:
"table01"
date | hours
"table02"
date | hours "table03"
date | hours .....
I have one table with relationship between tables to "cost-Center":
"table_cost-center"
table01 | 0010
table02 | 0030
table03 | 0020
table04 | 0040
table05 | 0060
......
I have to calculate the sum of hours between date 1 and date 2 of each cost-center in a loop. I need to display each sum of every single cost-center and calculate the total sum of all cost-centers together.
My Idea:
$whours= mysql_query ("SELECT sum(hours) FROM `$cost-center_tabelle[$z]` WHERE `$cost-center_table[$z]`.date BETWEEN '$date2' AND '$date1'
Aucun commentaire:
Enregistrer un commentaire