select * from t1
1 2005
2 2006
----
select * from t2
1 1 2005
2 1 2006
3 2 2005
4 3 2006
5 2005
6 2006
----
select t1.year,t2.no from t1,t2 where t1.year=t2.year(+) order by t2.no
1 2005 1
2 2006 1
3 2005 2
4 2006 3
5 2005
6 2006

解决方案 »

  1.   

    可以试试:
    SELECT * FROM T1
    UNION ALL
    SELECT * FROM T2
    不知道理解的对不对!!
      

  2.   

    突然想起来,如果你的T1表没有NO字段的话,怎么查都不会出现你要的结果的!!
      

  3.   

    个人意见:你要得到的集合应该是t1,t2做连接后,再和t2做比较出来的结果。
    所以,
    select a.year,b.no
    from (select distinct a.year year,b.no no from t1,t2) a,
    t2 b
    where a.year=b.year(+)
    and a.no=b.no(+) 
      

  4.   

    select a.year,b.no
    from (select distinct t1.year year,t2.no no from t1,t2) a,
    t2 b
    where a.year=b.year(+)
    and a.no=b.no(+)