Yet another sum question...
I have scoured the net and forums for a way to implement what I need, however either I am an idiot or it hasn't been discussed. I choose idiot 🙂
Problem:
I have about 10 fields that each have data in them(rows).
I currently have the contents being dumped by using SELECT * from turns where date=CURDATE()
Combine that with a if,while,else statement works fine for dumping the data(which is what I want)
I also want to add each field's row values individually(except date of course)
I have been able to simply use the following query to get the sum results:
SELECT SUM(servreq),SUM(requestid) from turns
I am then able to get the added values correctly for both of those fields.
However, when attempting to add the to dump all data as well i have issues. I have used:
SELECT ,SUM(servreq),SUM(requestid) from turns GROUP BY date
I have also used other fields in the group by section.
That gives me grouped results for each row that dumps in the while statement.
Basically what I need is a way to dump all my data to the page and get the sum of each field to display at the bottom.
example:
Date | Field | Field | Field
2002 | 1 | 3 | 7
2002 | 1 | 3 | 7
2002 | 1 | 3 | 7
2002 | 1 | 3 | 7
SUM | 4 | 12 | 28
I can't seem to get SUM(), * and group by to work for me.
This also may have been a terrible description as I am at work and have a headache.
Thanks to anyone who reads my drivel