回答編集履歴
3
update
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
美しさは兎も角、一応できている様です
|
1
|
+
美しさは兎も角、一応できている様です。Postgresqlで書いていますのはご容赦ください。
|
2
2
|
|
3
3
|
```sql
|
4
4
|
|
2
update
test
CHANGED
@@ -19,25 +19,3 @@
|
|
19
19
|
where t1.AA=t2.AA and t1.CC=t2.CC
|
20
20
|
|
21
21
|
```
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
withでも同じ様になってしまいました
|
28
|
-
|
29
|
-
```with
|
30
|
-
|
31
|
-
with tbl2 as (select AA, BB, count(*) CC
|
32
|
-
|
33
|
-
from tbl1 group by AA, BB)
|
34
|
-
|
35
|
-
select t2.AA, t2.BB, t2.CC from tbl2 t2,
|
36
|
-
|
37
|
-
(select AA, max(CC) CC from tbl2 group by AA) t3
|
38
|
-
|
39
|
-
where t2.AA=t3.AA and t2.CC=t3.CC
|
40
|
-
|
41
|
-
order by t2.AA, t2.BB;
|
42
|
-
|
43
|
-
```
|
1
update
test
CHANGED
@@ -19,3 +19,25 @@
|
|
19
19
|
where t1.AA=t2.AA and t1.CC=t2.CC
|
20
20
|
|
21
21
|
```
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
withでも同じ様になってしまいました
|
28
|
+
|
29
|
+
```with
|
30
|
+
|
31
|
+
with tbl2 as (select AA, BB, count(*) CC
|
32
|
+
|
33
|
+
from tbl1 group by AA, BB)
|
34
|
+
|
35
|
+
select t2.AA, t2.BB, t2.CC from tbl2 t2,
|
36
|
+
|
37
|
+
(select AA, max(CC) CC from tbl2 group by AA) t3
|
38
|
+
|
39
|
+
where t2.AA=t3.AA and t2.CC=t3.CC
|
40
|
+
|
41
|
+
order by t2.AA, t2.BB;
|
42
|
+
|
43
|
+
```
|