回答編集履歴
1
追記
test
CHANGED
@@ -13,3 +13,59 @@
|
|
13
13
|
```
|
14
14
|
|
15
15
|
ということですか?
|
16
|
+
|
17
|
+
# 追記
|
18
|
+
|
19
|
+
```SQL
|
20
|
+
|
21
|
+
insert into amount_day( amount_day,
|
22
|
+
|
23
|
+
APLAN,
|
24
|
+
|
25
|
+
APLANcount,
|
26
|
+
|
27
|
+
BPLAN,
|
28
|
+
|
29
|
+
BPLANcount,
|
30
|
+
|
31
|
+
CPLAN,
|
32
|
+
|
33
|
+
CPLANcount )
|
34
|
+
|
35
|
+
select
|
36
|
+
|
37
|
+
play_task.play_day,
|
38
|
+
|
39
|
+
sum((play_task.plan_id = 1)*plan.main_time) as s1,
|
40
|
+
|
41
|
+
sum(play_task.plan_id = 1) as c1,
|
42
|
+
|
43
|
+
sum((play_task.plan_id = 2)*plan.main_time) as s2,
|
44
|
+
|
45
|
+
sum(play_task.plan_id = 2) as c2,
|
46
|
+
|
47
|
+
sum((play_task.plan_id = 3)*plan.main_time) as s3,
|
48
|
+
|
49
|
+
sum(play_task.plan_id = 3) as c3
|
50
|
+
|
51
|
+
from play_task left join plan on
|
52
|
+
|
53
|
+
play_task.plan_id = plan.id
|
54
|
+
|
55
|
+
group by play_day
|
56
|
+
|
57
|
+
on duplicate key update
|
58
|
+
|
59
|
+
APLAN=values(APLAN),
|
60
|
+
|
61
|
+
APLANcount=values(APLANcount),
|
62
|
+
|
63
|
+
BPLAN=values(BPLAN),
|
64
|
+
|
65
|
+
BPLANcount=values(BPLANcount),
|
66
|
+
|
67
|
+
CPLAN=values(CPLAN),
|
68
|
+
|
69
|
+
CPLANcount=values(CPLANcount)
|
70
|
+
|
71
|
+
```
|