回答編集履歴

1

調整

2019/10/15 09:33

投稿

yambejp
yambejp

スコア116688

test CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
  - 集計
26
26
 
27
- ```
27
+ ```SQL
28
28
 
29
29
  select t1.id,t2.date,t1.complete,t2.profit from (
30
30
 
@@ -43,3 +43,19 @@
43
43
  left join report as t2 using(id)
44
44
 
45
45
  ```
46
+
47
+
48
+
49
+ - union allするなら
50
+
51
+ ```SQL
52
+
53
+ select * from(
54
+
55
+ select id,date,complete,profit from report where date like '%2019-01%'
56
+
57
+ union all select null,null,sum(complete),sum(profit) from report where date like '%2019-01%'
58
+
59
+ ) as sub
60
+
61
+ ```