回答編集履歴
3
追記しました
test
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
-
|
1
|
+
######修正分
|
2
2
|
|
3
|
+
|
4
|
+
|
5
|
+
サブクエリで遅いというのは、こんな感じにした場合ことでしょうか?
|
6
|
+
|
3
|
-
|
7
|
+
SQLがあると、アドバイスがつきやすいかもしれません。
|
4
8
|
|
5
9
|
|
6
10
|
|
@@ -14,8 +18,16 @@
|
|
14
18
|
|
15
19
|
on ...
|
16
20
|
|
21
|
+
join (select ... // fooの数とコメントの数が一致していれば、postsとcommentsをjoinできるような要素を出力する
|
22
|
+
|
23
|
+
from comments
|
24
|
+
|
25
|
+
goup by postid) as filterdComments
|
26
|
+
|
27
|
+
on ...
|
28
|
+
|
17
29
|
join comments
|
18
30
|
|
19
|
-
on
|
31
|
+
on ...
|
20
32
|
|
21
33
|
```
|
2
微修正
test
CHANGED
@@ -16,6 +16,6 @@
|
|
16
16
|
|
17
17
|
join comments
|
18
18
|
|
19
|
-
on (... and xxx = hoge)
|
19
|
+
on (... and xxx = hoge) --※xxx = hoge はそれらしい条件に置き換えてください
|
20
20
|
|
21
21
|
```
|
1
まちがえたので修正~
test
CHANGED
@@ -10,22 +10,12 @@
|
|
10
10
|
|
11
11
|
from users
|
12
12
|
|
13
|
-
join (select ...
|
14
|
-
|
15
|
-
|
13
|
+
join posts
|
16
|
-
|
17
|
-
join (select ...
|
18
|
-
|
19
|
-
from comments
|
20
|
-
|
21
|
-
where ...)
|
22
|
-
|
23
|
-
on ...
|
24
|
-
|
25
|
-
where ...)
|
26
14
|
|
27
15
|
on ...
|
28
16
|
|
29
|
-
|
17
|
+
join comments
|
18
|
+
|
19
|
+
on (... and xxx = hoge)
|
30
20
|
|
31
21
|
```
|