select a.nrfl, letterProcessed, letterProcessing from (select nrfl, count(docid) as letterProcessed from wsxf_document where status != 4and create_Date >='2011-11-11 00:00:00' and create_date <= '2011-12-01 23:59:59'group by nrfl) a full outer join (select nrfl, count(docid) as letterProcessing from wsxf_document where status = 4 and create_Date >='2011-11-11 00:00:00' and create_date <= '2011-12-01 23:59:59' group by nrfl) b on a.nrfl = b.nrfl请教高手,怎样把属于左右表中nrfl字段的的所有的内容在同一个字段中显示出来
select a.nrfl||' '||b.nrfl as ab_nrf1
....
from ...
-- 如果nrfl字段是整数类型:
select to_char(a.nrfl,'999999999999999')||' '||to_char(b.nrfl,'999999999999999') as ab_nrf1
....
from ...
-- 如果nrfl字段是浮点数类型:
select to_char(a.nrfl,'9999999999999990D999')||' '||to_char(b.nrfl,'9999999999999990D999') as ab_nrf1
....
from ...
(case when a.nrf1=b.nrf1 then a.nrf1
when a.nrf1 is null and b.nrf1 is not null then b.nrf1
when b.nrf1 is null and a.nrf1 is not null then a.nrf1
else null end ) as nrf1
from ......
因为你的查询中有条件 a.nrf1 = b.nrf1