有三种关系(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