Jump to content

[SOLVED] mysql UNION + count(*)


phorcon3

Recommended Posts

$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?

Link to comment
https://forums.phpfreaks.com/topic/120167-solved-mysql-union-count/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.