这样行不:
select sum1 ,sum2 ,sum3
from (select Company_Name,Tax_Type,sum(Tax_number) sum1
from table1
where substr(to_char(Tax_Time),1,6)=substr(to_char(sysdate,'YYYYMMDD'),1,6)
and Company_Name like '%北京%'
group by Company_Name,Tax_Type) tab_1,
(select Company_Name,Tax_Type,sum(Tax_number) sum2
from table1
where substr(to_char(Tax_Time),1,4)=substr(to_char(sysdate,'YYYYMMDD'),1,4)
and Company_Name like '%北京%'
group by Company_Name,Tax_Type) tab_2,
(select Company_Name,Tax_Type,sum(Tax_Number) sum3
from table1
where Company_Name like '%北京%'
group by Company_Name,Tax_Type) tab_3
where tab_1.Company_Name = tab_2.Company_Name(+)
and tab_1.Tax_Type = tab_2.Tax_Type(+)
and tab_1.Company_Name = tab_3.Company_Name(+)
and tab_1.Tax_Type = tab_3.Tax_Type(+);
select sum1 ,sum2 ,sum3
from (select Company_Name,Tax_Type,sum(Tax_number) sum1
from table1
where substr(to_char(Tax_Time),1,6)=substr(to_char(sysdate,'YYYYMMDD'),1,6)
and Company_Name like '%北京%'
group by Company_Name,Tax_Type) tab_1,
(select Company_Name,Tax_Type,sum(Tax_number) sum2
from table1
where substr(to_char(Tax_Time),1,4)=substr(to_char(sysdate,'YYYYMMDD'),1,4)
and Company_Name like '%北京%'
group by Company_Name,Tax_Type) tab_2,
(select Company_Name,Tax_Type,sum(Tax_Number) sum3
from table1
where Company_Name like '%北京%'
group by Company_Name,Tax_Type) tab_3
where tab_1.Company_Name = tab_2.Company_Name(+)
and tab_1.Tax_Type = tab_2.Tax_Type(+)
and tab_1.Company_Name = tab_3.Company_Name(+)
and tab_1.Tax_Type = tab_3.Tax_Type(+);
select sum1 ,sum2 ,sum3 from (select Company_Name,Tax_Type,sum(Tax_number) sum1 from table1 where substr(to_char(Tax_Time),1,6)=substr(to_char(sysdate,'YYYYMMDD'),1,6) and Company_Name like '%北京%' group by Company_Name,Tax_Type) tab_1,(select Company_Name,Tax_Type,sum(Tax_number) sum2 from table1 where substr(to_char(Tax_Time),1,4)=substr(to_char(ADD_MONTHS(sysdate,-12),'YYYYMMDD'),1,4) and Company_Name like '%北京%' group by Company_Name,Tax_Type) tab_2,(select Company_Name,Tax_Type,sum(Tax_Number) sum3 from table1 where Company_Name like '%北京%' group by Company_Name,Tax_Type) tab_3;