mysql使用 union all查询统计总数量
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(注意这里要取个别名)
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(注意这里要取个别名)