select sum(a.b) as num from (select count() as b from table_1 union all select count() as b from table_2) as a(注意这里要取个别名)