質問編集履歴
3
作成途中SQL
test
CHANGED
File without changes
|
test
CHANGED
@@ -55,3 +55,35 @@
|
|
55
55
|
<出力したい表>
|
56
56
|
|
57
57
|
![イメージ説明](9c3c611430b8d8542d27eb07a25dc22a.png)
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
<作成途中SQL>
|
62
|
+
|
63
|
+
```
|
64
|
+
|
65
|
+
SELECT
|
66
|
+
|
67
|
+
nengetsu
|
68
|
+
|
69
|
+
,name
|
70
|
+
|
71
|
+
,rank1
|
72
|
+
|
73
|
+
,rank2
|
74
|
+
|
75
|
+
,sum(kosu) AS KOSU
|
76
|
+
|
77
|
+
FROM
|
78
|
+
|
79
|
+
Bunseki
|
80
|
+
|
81
|
+
GROUP BY
|
82
|
+
|
83
|
+
GROUPING SETS((nengetsu,name,rank1),(nengetsu,name,rank2))
|
84
|
+
|
85
|
+
ORDER BY
|
86
|
+
|
87
|
+
nengetsu,name,rank1,rank2
|
88
|
+
|
89
|
+
```
|
2
DDL変更しております。ご指摘ありがとうございます。
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
(
|
14
14
|
|
15
|
-
g
|
15
|
+
nengetsu CHAR(6) NOT NULL,
|
16
16
|
|
17
17
|
name CHAR(3) NOT NULL,
|
18
18
|
|
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
rank2 CHAR(2) ,
|
22
22
|
|
23
|
-
kosu numer
|
23
|
+
kosu number );
|
24
24
|
|
25
25
|
|
26
26
|
|
1
コード修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
ご教示宜しく御願い致します。
|
4
4
|
|
5
5
|
|
6
|
+
|
7
|
+
```
|
6
8
|
|
7
9
|
<DDL>
|
8
10
|
|
@@ -40,6 +42,8 @@
|
|
40
42
|
|
41
43
|
INSERT INTO Bunseki VALUES ('201905', 'AAA', '08','09',7);
|
42
44
|
|
45
|
+
```
|
46
|
+
|
43
47
|
|
44
48
|
|
45
49
|
<対象テーブル>
|