回答編集履歴
1
追記
test
CHANGED
@@ -75,3 +75,55 @@
|
|
75
75
|
```
|
76
76
|
|
77
77
|
なんか効率的な方法がありそうな気がしますが・・・
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
- 別案
|
82
|
+
|
83
|
+
```SQL
|
84
|
+
|
85
|
+
select month
|
86
|
+
|
87
|
+
,sum(c1) as c1
|
88
|
+
|
89
|
+
,sum(c2) as c2
|
90
|
+
|
91
|
+
,sum(c3) as c3
|
92
|
+
|
93
|
+
,sum(c4) as c4
|
94
|
+
|
95
|
+
from
|
96
|
+
|
97
|
+
(select DATE_FORMAT(interview,'%Y%m') as month,count(*) as c1,0 as c2,0 as c3,0 as c4 from tbl group by month
|
98
|
+
|
99
|
+
union select DATE_FORMAT(decision,'%Y%m') as month,0,count(*),0,0 from tbl group by month
|
100
|
+
|
101
|
+
union select DATE_FORMAT(accept,'%Y%m') as month,0,0,count(*),0 from tbl group by month
|
102
|
+
|
103
|
+
union select DATE_FORMAT(ng,'%Y%m') as month,0,0,0,count(*) from tbl group by month
|
104
|
+
|
105
|
+
union select '201603',0,0,0,0
|
106
|
+
|
107
|
+
union select '201604',0,0,0,0
|
108
|
+
|
109
|
+
union select '201605',0,0,0,0
|
110
|
+
|
111
|
+
union select '201606',0,0,0,0
|
112
|
+
|
113
|
+
union select '201607',0,0,0,0
|
114
|
+
|
115
|
+
union select '201608',0,0,0,0
|
116
|
+
|
117
|
+
union select '201609',0,0,0,0
|
118
|
+
|
119
|
+
union select '201610',0,0,0,0
|
120
|
+
|
121
|
+
union select '201611',0,0,0,0
|
122
|
+
|
123
|
+
union select '201612',0,0,0,0
|
124
|
+
|
125
|
+
) as dummy
|
126
|
+
|
127
|
+
group by month;
|
128
|
+
|
129
|
+
```
|