千家信息网

mysql使用 union all查询统计总数量

发表于:2025-11-06 作者:千家信息网编辑
千家信息网最后更新 2025年11月06日,select sum(a.b) as num from (select count() as b from table_1union allselect count() as b from table
千家信息网最后更新 2025年11月06日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(注意这里要取个别名)

0