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 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
SELECT * FROM T1
UNION ALL
SELECT * FROM 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(+)
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(+)