回答編集履歴
2
調整
test
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
```
|
12
12
|
# クエリ
|
13
13
|
```SQL
|
14
|
-
select tbl1.no,coalesce(A,B) as name from(
|
14
|
+
select tbl1.no,coalesce(tbl2.A,tbl3.B) as name from(
|
15
15
|
select no from tbl2
|
16
16
|
union select no from tbl3
|
17
17
|
) as tbl1
|
1
調整
test
CHANGED
@@ -20,3 +20,15 @@
|
|
20
20
|
order by tbl1.no
|
21
21
|
```
|
22
22
|
※full outer joinしてそれにleft joinでつなぐ
|
23
|
+
|
24
|
+
# 結果
|
25
|
+
|no|name|
|
26
|
+
|:--:|:--|
|
27
|
+
|1|a1|
|
28
|
+
|2|a2|
|
29
|
+
|3|b3|
|
30
|
+
|4|a4|
|
31
|
+
|5|b5|
|
32
|
+
|6|NULL|
|
33
|
+
|7|NULL|
|
34
|
+
|8|NULL|
|