Re: SQL combine to summations queries?
| From: | Bas Jobsen | Date: | Thu, 06 Sep 2001 16:47:15 +0000 |
| Subject: | Re: SQL combine to summations queries? | ||
| References: | 1 2 3 4 5 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-12230@lists.php.net to get a copy of this message | ||
> To do what I think you are trying to do you would use something like:
> Select sum(table1.fielda),sum(table2.fieldb) from table1 LEFT JOIN table2
ON
> table1.id=table2.id;
> if table1.fielda has more rows.
> If table2.fieldb has more rows use:
the amount of rows is the same :)
> Select sum(table1.fielda),sum(table2.fieldb) from table2 LEFT JOIN table1
ON
> table1.id=table2.id;
>
> Hope that helps
Yes, it does, TNX!!!