phorcon3 Posted August 18, 2008 Share Posted August 18, 2008 $a=mysql_query("(SELECT Count(id) AS Count FROM `t1` WHERE `this` = '$_GET[text]') UNION (SELECT Count(id) AS Count FROM `t2` WHERE `this` = '$_GET[text]')"); $b=mysql_fetch_assoc($a); echo $b['Count']; that obviously only gives back the result from t1...but how can i make sure it adds both counts ..from t1 and t2? Quote Link to comment Share on other sites More sharing options...
Mchl Posted August 18, 2008 Share Posted August 18, 2008 SELECT ((SELECT Count(id) AS Count FROM `t1` WHERE `this` = '$_GET[text]') + (SELECT Count(id) AS Count FROM `t2` WHERE `this` = '$_GET[text]')) AS total Quote Link to comment Share on other sites More sharing options...
phorcon3 Posted August 18, 2008 Author Share Posted August 18, 2008 thanks!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.