回答編集履歴
3
訂正
test
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
from a x
|
12
12
|
|
13
|
-
where exists (
|
13
|
+
where not exists (
|
14
14
|
|
15
15
|
select 1 from a
|
16
16
|
|
2
訂正
test
CHANGED
@@ -16,8 +16,6 @@
|
|
16
16
|
|
17
17
|
where b_id = x.b_id and created_at > x.created_at
|
18
18
|
|
19
|
-
having count(*)=0
|
20
|
-
|
21
19
|
)
|
22
20
|
|
23
21
|
```
|
1
追記
test
CHANGED
@@ -1 +1,23 @@
|
|
1
1
|
最後のSQLのcount()をSum()に変更してみて下さい。
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
結果だけでいいなら以下の記述で。(未検証です)
|
6
|
+
|
7
|
+
```SQL
|
8
|
+
|
9
|
+
select count(*)
|
10
|
+
|
11
|
+
from a x
|
12
|
+
|
13
|
+
where exists (
|
14
|
+
|
15
|
+
select 1 from a
|
16
|
+
|
17
|
+
where b_id = x.b_id and created_at > x.created_at
|
18
|
+
|
19
|
+
having count(*)=0
|
20
|
+
|
21
|
+
)
|
22
|
+
|
23
|
+
```
|