如果两个条件匹配,MYSQL从两个表计数

I have two mysql tables on script. Now I need to display some notifications but problem is that two different tables are used for that and in one it's showed for user if there is pending and in second for admin. So admin must approve it for user to be showed.

This is my code:

$test=$mysql->echo_one("
    SELECT COUNT(*)
    FROM `cpm_ad_mapping`
    WHERE
        `status` = '-1' 
    AND `uid`    = '$uid'
");
$thead->setValue("{NON}", $test);

$test2=$mysql->echo_one("
    SELECT COUNT(*)
    FROM `cpm_ads`
    WHERE
        `status` = '1' 
    AND `uid`    = '$uid'
");
$thead->setValue("{NON1}", $test2);

How can I match these two status values so I get count if first is ='-1' and second is ='1'?

What you need is a join between this two tables:

SELECT COUNT(*)
FROM `cpm_ad_mapping` s
INNER JOIN `cpm_ads` t ON s.uid = t.uid
WHERE s.status = '-1' 
     AND t.status = '1'
     AND s.uid = '$uid'