并集后做1次累加
select sum(aaa) from
( select aaa from table01
union
select aaa from table02
union
..................
union
select aaa from table29
union
select aaa from table30
);
或者:
每张表累加后,再加一起
select sum(x) from
( select sum(aaa) as x from table01
union
select sum(aaa) as x from table02
union
..................
union
select sum(aaa) as x from table29
union
select sum(aaa) as x from table30
)
select sum(aaa) from
( select aaa from table01
union
select aaa from table02
union
..................
union
select aaa from table29
union
select aaa from table30
) as t ;