Re: Averaging columns in two tables?
| From: | elias | Date: | Thu, 12 Jul 2001 08:34:16 +0000 |
| Subject: | Re: Averaging columns in two tables? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-57554@lists.php.net to get a copy of this message | ||
try,
$result = mysql_query("select avg(tbl1.age) as avg1, avg(tbl2.age) as avg2
from tbl1, tbl2");
$r = mysql_fetch_array($result);
$avg = ($r["avg1"] + $r["avg2"]) / 2;
"Jeff Lewis" <jeff@hyrum.net> wrote in message
news:007d01c10a36$c657f750$76a1a8c0@LEWISJCIT...
Is it possible to get the average of two tables. I have an age column in
two tables. I can get the age average for one table both can the average of
both tables be found in one statement? One table is for hitters, the other
for pitchers.
Jeff