回答編集履歴
3
update
answer
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
美しさは兎も角、一応できている様です
|
1
|
+
美しさは兎も角、一応できている様です。Postgresqlで書いていますのはご容赦ください。
|
2
2
|
```sql
|
3
3
|
select t1.AA, t1.BB, t1.CC from
|
4
4
|
(select AA, BB, count(*) CC from tbl1
|
2
update
answer
CHANGED
@@ -8,15 +8,4 @@
|
|
8
8
|
group by AA, BB) t3
|
9
9
|
group by AA) t2
|
10
10
|
where t1.AA=t2.AA and t1.CC=t2.CC
|
11
|
-
```
|
12
|
-
|
13
|
-
|
14
|
-
withでも同じ様になってしまいました
|
15
|
-
```with
|
16
|
-
with tbl2 as (select AA, BB, count(*) CC
|
17
|
-
from tbl1 group by AA, BB)
|
18
|
-
select t2.AA, t2.BB, t2.CC from tbl2 t2,
|
19
|
-
(select AA, max(CC) CC from tbl2 group by AA) t3
|
20
|
-
where t2.AA=t3.AA and t2.CC=t3.CC
|
21
|
-
order by t2.AA, t2.BB;
|
22
11
|
```
|
1
update
answer
CHANGED
@@ -8,4 +8,15 @@
|
|
8
8
|
group by AA, BB) t3
|
9
9
|
group by AA) t2
|
10
10
|
where t1.AA=t2.AA and t1.CC=t2.CC
|
11
|
+
```
|
12
|
+
|
13
|
+
|
14
|
+
withでも同じ様になってしまいました
|
15
|
+
```with
|
16
|
+
with tbl2 as (select AA, BB, count(*) CC
|
17
|
+
from tbl1 group by AA, BB)
|
18
|
+
select t2.AA, t2.BB, t2.CC from tbl2 t2,
|
19
|
+
(select AA, max(CC) CC from tbl2 group by AA) t3
|
20
|
+
where t2.AA=t3.AA and t2.CC=t3.CC
|
21
|
+
order by t2.AA, t2.BB;
|
11
22
|
```
|