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, SGreen@stripped <SGreen@stripped> wrote:
> "Dave Kennedy" <davek@stripped> 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
>
> Without actually seeing your actual data it is nearly impossible to help
> you diagnose this issue. Especially since your results seem to match your
> descriptions (4 rows of data in one table = 4 rows of results if you do it
> one way....)
>
> Please post your table structures (SHOW CREATE TABLE xxx\G) and your
> sample data (SELECT * FROM xxx;), then show us what you think your queries
> SHOULD have given you (your expected results) and we can start to help.
> The xxx in the sample commands was just a placeholder for the actual table
> names of your data.
>
> Shawn Green
> Database Administrator
> Unimin Corporation - Spruce Pine
>
>
--
Eric Bergen
eric.bergen@stripped
http://www.ebergen.net