要怎样才能把所有数据查询出来(不符合条件的也需要)
li123 2004-11-01 06:15:09 我用如下语句:select
a.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
where
a.f_unit_name = b.f_unit_name(+)
and
a.f_unit_name = c.f_unit_name(+)
and
a.f_unit_name = d.f_unit_name(+)
总的有四个部门,我要所有部门的数据,为空也要。
但是我用这个语句提不到所有数据,如果在一个表里没有数据就查不到了。
请问应如何做?
谢谢!!!