oracle中的外连接:SQL> select * from a1;BBB
----------
101
102
103
104
105SQL> select * from a2;BBB CCC
---------- --------------------
101
102
105SQL> select * from a1,a2 where a1.bbb(+)=a2.bbb;BBB BBB CCC
---------- ---------- --------------------
101 101
102 102
105 105SQL> select * from a1,a2 where a1.bbb=a2.bbb(+);BBB BBB CCC
---------- ---------- --------------------
101 101
102 102
103
104
105 105SQL>
----------
101
102
103
104
105SQL> select * from a2;BBB CCC
---------- --------------------
101
102
105SQL> select * from a1,a2 where a1.bbb(+)=a2.bbb;BBB BBB CCC
---------- ---------- --------------------
101 101
102 102
105 105SQL> select * from a1,a2 where a1.bbb=a2.bbb(+);BBB BBB CCC
---------- ---------- --------------------
101 101
102 102
103
104
105 105SQL>
(select .. from ..) a2
where a1.col1(+) = a2.col1;
这样同样可以的。
select * from (select .. from ..) a1,
(select .. from ..) a2,
(select .. from ..) a3
where a1.col1(+) = a2.col1 and
a3.col1(+) = a2.col1;
当然,WHERE部分一定要修改的,对于外连接涉及到多个表时比较复杂,你还是看看有关书籍为好。