select
e.f_unit_name,
a.breportCount,
b.thisreportCount,
c.badoptCount,
d.thisadoptCount
from
(select
t.f_unit_name,
sum(decode(t.f_is_adopt,'',0,1)) breportCount
from
t_ducha_file_info t
where
to_char(t.f_send_date,'yyyy-mm-dd') between '2002-6-1' and '2004-11-1'
group by
t.f_unit_name ) a ,
(select
t.f_unit_name,
sum(decode(t.f_is_adopt,'',0,1)) thisreportCount
from
t_ducha_file_info t
where
to_char(t.f_send_date,'yyyy-mm-dd') between '2002-6-1' and '2004-11-1'
group by
t.f_unit_name ) b ,
(select
t.f_unit_name,
sum(decode(t.f_is_adopt,'1',0,1)) badoptCount
from
t_ducha_file_info t
where
to_char(t.f_send_date,'yyyy-mm-dd') between '2002-6-1' and '2003-11-1'
group by
t.f_unit_name ) c ,
(select
t.f_unit_name,
sum(decode(t.f_is_adopt,'1',0,1)) thisadoptCount
from
t_ducha_file_info t
where
to_char(t.f_send_date,'yyyy-mm-dd') between '2002-6-1' and '2004-11-1'
group by
t.f_unit_name ) d,
t_ducha_file_info e,
where
e.f_unit_name = a.f_unit_name(+)
and
e.f_unit_name = b.f_unit_name(+)
and
e.f_unit_name = c.f_unit_name(+)
and
e.f_unit_name = d.f_unit_name(+)
e.f_unit_name,
a.breportCount,
b.thisreportCount,
c.badoptCount,
d.thisadoptCount
from
(select
t.f_unit_name,
sum(decode(t.f_is_adopt,'',0,1)) breportCount
from
t_ducha_file_info t
where
to_char(t.f_send_date,'yyyy-mm-dd') between '2002-6-1' and '2004-11-1'
group by
t.f_unit_name ) a ,
(select
t.f_unit_name,
sum(decode(t.f_is_adopt,'',0,1)) thisreportCount
from
t_ducha_file_info t
where
to_char(t.f_send_date,'yyyy-mm-dd') between '2002-6-1' and '2004-11-1'
group by
t.f_unit_name ) b ,
(select
t.f_unit_name,
sum(decode(t.f_is_adopt,'1',0,1)) badoptCount
from
t_ducha_file_info t
where
to_char(t.f_send_date,'yyyy-mm-dd') between '2002-6-1' and '2003-11-1'
group by
t.f_unit_name ) c ,
(select
t.f_unit_name,
sum(decode(t.f_is_adopt,'1',0,1)) thisadoptCount
from
t_ducha_file_info t
where
to_char(t.f_send_date,'yyyy-mm-dd') between '2002-6-1' and '2004-11-1'
group by
t.f_unit_name ) d,
t_ducha_file_info e,
where
e.f_unit_name = a.f_unit_name(+)
and
e.f_unit_name = b.f_unit_name(+)
and
e.f_unit_name = c.f_unit_name(+)
and
e.f_unit_name = d.f_unit_name(+)
非常谢谢,我想怕没有人会给我解答,代码太乱了,
再次感谢zmgowin。