有三種關係(T1,T2,T3):自然全外連接?
t1
-----------
a | b
1 | 2
-----------
t2
------------
b | c
2 | 3
------------
t3
-------------
a | c
4 | 5
-------------
查詢是:
select * from t1 natural full outer join (t2 natural full outer join t3);
的select * from t2 natural full outer join t3
結果是:
-----------------
a | b | c
| 2 | 3
4 | | 5
------------------
然後我想:
select * from t1 natural full outer join (result)
t1 result
----------- -----------------
a | b a | b | c
1 | 2 | 2 | 3
4 | | 5
------------------
不應該是這樣:
--------------------------
a | b | c
1 | 2 | 3
4 | | 5
但我不知道爲什麼SQL查詢得出:
a | b | c
4 | | 5
| 2 | 3
1 | 2 |
我刪除了MySQL標籤,因爲它不支持完整的外連接。 –
完全外連接在mysql中不存在。如果你想模擬它,看看這篇文章:http://stackoverflow.com/questions/4796872/full-outer-join-in-mysql – Grumpy