Re: Sum() unequal number of rows

2005-03-08 Thread Ian Sales (DBA)
"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 sele

Re: Sum() unequal number of rows

2005-03-07 Thread Eric Bergen
Since those two queries don't seem to have any relation other than being from the same table it seems more logical to keep them two separate queries. On Mon, 7 Mar 2005 15:30:16 -0500, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > "Dave Kennedy" <[EMAIL PROTECTED]> wrote on 03/06/2005 05:09:36 P

Re: Sum() unequal number of rows

2005-03-07 Thread SGreen
"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 v

Sum() unequal number of rows

2005-03-06 Thread Dave Kennedy
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 corre