"Dave Kennedy" <[EMAIL PROTECTED]> wrote on 03/06/2005 05:09:36 PM:
SELECT sum(col1) AS total1
FROM t1
GROUP by col1
SELECT col1, sum(col2) AS total2
FROM t2
GROUP by col2
Table t1 contains 4 rows to sum for each value in col1
Table t2 contains 8 rows to sum for each value in col2
If one select statement is used, the result has 8 rows and total2 is
correct but the tota11 is summed over 8 rows instead of 4
How can they be joined to produce one row total1, total2
- UNION? (http://dev.mysql.com/doc/mysql/en/union.html)
--
+-------------------------------------------------------------------+
| Ian Sales Database Administrator |
| |
| "All your database are belong to us" |
| ebuyer http://www.ebuyer.com |
+-------------------------------------------------------------------+
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]