答案 0 :(得分:0)
首先,您需要将所有30个视图UNION ALL
合并为一个“表表达式”,然后按财务年度从中进行选择,如:
select financial_year,
sum(status_1) as status_1,
sum(status_0) as status_0,
sum(status_2) as status_2,
sum(status_3) as status_3,
sum(status_4) as status_4
from (
select financial_year, status_1, status_0, status_2, status_3, status_4,
totals from view1
union all
select financial_year, status_1, status_0, status_2, status_3, status_4,
totals from view2
union all
select financial_year, status_1, status_0, status_2, status_3, status_4,
totals from view3
union all
... -- add view4 to view30 here
) x
group by financial_year;