回答編集履歴
1
調整
answer
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
(5,'2020-01-03',4,10000);
|
12
12
|
```
|
13
13
|
- 集計
|
14
|
-
```
|
14
|
+
```SQL
|
15
15
|
select t1.id,t2.date,t1.complete,t2.profit from (
|
16
16
|
select id,sum(complete) as complete,sum(profit) as profit
|
17
17
|
from report
|
@@ -20,4 +20,12 @@
|
|
20
20
|
with rollup
|
21
21
|
) as t1
|
22
22
|
left join report as t2 using(id)
|
23
|
+
```
|
24
|
+
|
25
|
+
- union allするなら
|
26
|
+
```SQL
|
27
|
+
select * from(
|
28
|
+
select id,date,complete,profit from report where date like '%2019-01%'
|
29
|
+
union all select null,null,sum(complete),sum(profit) from report where date like '%2019-01%'
|
30
|
+
) as sub
|
23
31
|
```
|