如何使用这两个表获得以下结果
TipoComponenteID1 TipoComponenteID2
-------------------------------------
1 1
NULL 3
6 NULL
8 NULL
9 NULL
10 NULL
TipoComponenteID1
TipoComponenteID1
-----------------
1
6
8
9
10
TipoComponenteID2
TipoComponenteID2
-----------------
1
3
答案 0 :(得分:1)
这可以通过简单的FULL OUTER JOIN
来解决。
SELECT
TCID1 = t1.[your id column here]
,TCID2 = t2.[your id column here]
FROM TipoComponenteID1 t1
FULL OUTER JOIN TipoComponenteID2 t2 ON t1.[your id column here] = t2.[your id column here]