I have a PHP script which queries the database and returns a number of matching rows as follows:
What I want is a final row which is a total of each column.
SELECT name, open_wip, clock_hrs, close_wip, avail_hrs, sold_hrs, sold_amt, cost_hrs, cost_amt, labour_gross, margin, docs, unprod_hrs, sold_avail FROM ReportData
I'm thinking there are 2 options:
1. Run another SQL to get the sum of each row and add it to the array I create
2. Use PHP to add all the rows together (don't know how to do this yet inside the array - was just assuminf I'd loop through each row adding it to the last)
I do not see either method as efficient and was wondering if there is a function I don't know of that can make it easier simpler?