how to find biggest value of a field across 2 tables?
| From: | Noah Spitzer-Williams | Date: | Thu, 05 Jul 2001 13:28:05 +0000 |
| Subject: | how to find biggest value of a field across 2 tables? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-10073@lists.php.net to get a copy of this message | ||
i have two tables each with a same field and i would like to find which
table has the bigger value in this field..
is there a way to do this with one select statement?
i've tried things like:
select max(t1.bannerid) as b, max(t2.bannerid) as a,
IF(t1.bannerid>t2.bannerid,t1.bannerid,t2.bannerid) FROM user_banners as t1,
user_banners_approve as t2 ORDER BY t1.bannerid DESC GROUP BY t1.bannerid
but im not having much luck.
thanks guy!
- noah