我想知道我是否可以首先在完整列列表上的两个表之间执行完整外部联接,如果失败,则执行部分列列表。例如:
Table A
| a | b | c |
+-----+-----+-----+
| x | y | z |
| q | r | s |
Table B
| a | b | c | d | e |
+-----+-----+-----+-----+-----+
| q | r | s | t | u |
| q | r | | x | y |
| | | | x | y |
Failed query:
SELECT *
FROM A FULL OUTER JOIN B
ON
(A.a = B.a AND A.b = B.b AND A.c = B.c)
OR (A.a = B.a AND A.b = B.b)
Desired result
| a | b | c | d | e |
+-----+-----+-----+-----+-----+
| x | y | z | | |
| q | r | s | t | u |
| q | r | | x | y |
| | | | x | y |
我正在使用 Postgresql。感谢你的协助。