I am running the query below:

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
GROUP BY product with rollup

Here are the results:
+------------------------------+-------+-------+-------+
| 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 |
| Draft with Direct Deposit    |  5.00 |     0 |  0.00 |
| Draft without Direct Deposit |  3.00 |     0 |  0.00 |
| E-statement                  |  5.00 |     2 | 10.00 |
| Gap                          | 20.00 |     0 |  0.00 |
| MBI                          | 10.00 |     0 |  0.00 |
| Membersonline                |  5.00 |     0 |  0.00 |
| New Account                  |  5.00 |     1 |  5.00 |
| New Loan                     |  5.00 |     0 |  0.00 |
| New Mem"Bear" Account        |  5.00 |     0 |  0.00 |
| NULL                         |  5.00 |     8 | 40.00 |
+------------------------------+-------+-------+-------+
14 rows in set (0.00 sec)

As you can see the summary total in the 'Total' column is incorrect.  The
summary total should be 36 but is spitting out 40.  I am not even sure where
it is getting 40.  The only way to get 40 is if it is multiplying 5X8.

I am running MySQL 4.1.15.  Also the 'price' column has the wrong total.  I
am not really concerned with that total.  I just want the summary total in
the 'Total' column to be correct.

Any suggestions?

Thank You,

Noel Stratton
Computer Specialist
Members 1st Credit Union 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to