回答編集履歴
1
追記
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
```
|
5
|
+
```sql
|
6
6
|
|
7
7
|
select A.id, A.cook from A
|
8
8
|
|
@@ -10,10 +10,38 @@
|
|
10
10
|
|
11
11
|
inner join B on B.id = C.bid
|
12
12
|
|
13
|
-
where B.
|
13
|
+
where B.id in (1, 3)
|
14
14
|
|
15
15
|
group by A.id, A.cook
|
16
16
|
|
17
17
|
having count(*) = 2
|
18
18
|
|
19
19
|
```
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
distinct で重複を除外してもいいかもしれません。
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
```sql
|
28
|
+
|
29
|
+
select A.id, A.cook
|
30
|
+
|
31
|
+
from A
|
32
|
+
|
33
|
+
inner join C on A.id = C.aid
|
34
|
+
|
35
|
+
inner join B on B.id = C.bid
|
36
|
+
|
37
|
+
where B.id in (1, 3)
|
38
|
+
|
39
|
+
group by A.id, A.cook
|
40
|
+
|
41
|
+
having count(distinct B.id) = 2;
|
42
|
+
|
43
|
+
```
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|