| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Dave Kennedy | Date: | March 6 2005 10:09pm |
| Subject: | Sum() unequal number of rows | ||
| View as plain text | |||
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
| Thread | ||
|---|---|---|
| • Sum() unequal number of rows | Dave Kennedy | 6 Mar |
| • Re: Sum() unequal number of rows | SGreen | 7 Mar |
| • Re: Sum() unequal number of rows | Eric Bergen | 7 Mar |
| • Re: Sum() unequal number of rows | DBA) | 8 Mar |
