Sum of a group
I posted this in the mysql newbie and have not gotten any results. maybe php can help?
I am working on a sales tracking project. See below query
SELECT products.product, products.price, count( log.product ) AS 'Count', ROUND(price*count(log.product), 2) AS 'Total'
FROM products LEFT JOIN log ON products.product= log.product
WHERE log.date_sold between 'colname' and 'colname2' and log.employee_id = 'colname3'
GROUP BY product
+------------------------------+-------+-------+-------+
| product | price | Count | Total |
+------------------------------+-------+-------+-------+
| ATM Card | 3.00 | 2 | 6.00 |
| Audio Response | 3.00 | 0 | 0.00 |
| Check Card | 5.00 | 1 | 5.00 |
| Courtesy Pay | 5.00 | 2 | 10.00 |
I am trying to add up all the Total numbers. So for example the total would be 21.00. Is there a way to add this up in mysql or php?
Subject
Written By
Posted
Sum of a group
November 10, 2005 05:08PM
November 11, 2005 12:51AM
November 11, 2005 12:33PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.