日期:2014-05-17 浏览次数:20819 次
SQL> with tb as( 2 select '2001' dt1,10 num1,'2003' dt2,3 num2 from dual union all 3 select '2004',3,'2000',5 from dual union all 4 select '2003',5,'2001',2 from dual) 5 select nvl(a.dt1,b.dt2) dt,nvl(a.num1,0),nvl(b.num2,0) 6 from tb a full join tb b 7 on a.dt1=b.dt2 8 order by dt 9 / DT NVL(A.NUM1,0) NVL(B.NUM2,0) ---- ------------- ------------- 2000 0 5 2001 10 2 2003 5 3 2004 3 0