回答編集履歴

2

コード修正

2020/08/13 10:42

投稿

hatena19
hatena19

スコア34075

test CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  FROM (
10
10
 
11
- select id, name as n1, null as n2, null as n3 , null as n4 from mybook
11
+ select id, name n1, null n2, null n3 , null n4 from mybook
12
12
 
13
13
  union all select id, null, name, null, null from mybook2
14
14
 

1

コード微修正

2020/08/13 10:42

投稿

hatena19
hatena19

スコア34075

test CHANGED
@@ -4,11 +4,11 @@
4
4
 
5
5
  ```sql
6
6
 
7
- SELECT base.id, max(name1) name1, max(name2) name2, max(name3) name3, max(name4) name4
7
+ SELECT base.id, max(n1) name1, max(n2) name2, max(n3) name3, max(n4) name4
8
8
 
9
9
  FROM (
10
10
 
11
- select id, name as name1, null as name2, null as name3 , null as name4 from mybook
11
+ select id, name as n1, null as n2, null as n3 , null as n4 from mybook
12
12
 
13
13
  union all select id, null, name, null, null from mybook2
14
14
 
@@ -16,8 +16,8 @@
16
16
 
17
17
  union all select id, null, null, null, name from mybook4
18
18
 
19
- ) base
19
+ ) base
20
20
 
21
- group by id;
21
+ group by id;
22
22
 
23
23
  ```