回答編集履歴
3
chousei
test
CHANGED
@@ -16,7 +16,9 @@
|
|
16
16
|
(4,2,3,0),
|
17
17
|
(5,1,2,0),
|
18
18
|
(5,2,1,1);
|
19
|
-
|
19
|
+
```
|
20
|
+
として、
|
21
|
+
```SQL
|
20
22
|
select * from replay as t1
|
21
23
|
where (select 1
|
22
24
|
from replay
|
2
chousei
test
CHANGED
@@ -24,3 +24,12 @@
|
|
24
24
|
having group_concat(chra_id order by chra_id asc)='1,2'
|
25
25
|
and replay_id=t1.replay_id);
|
26
26
|
```
|
27
|
+
もしくは
|
28
|
+
```SQL
|
29
|
+
select * from replay as t1
|
30
|
+
where (select 1
|
31
|
+
from replay
|
32
|
+
group by replay_id
|
33
|
+
having sum(chra_id in(1,2))=2
|
34
|
+
and replay_id=t1.replay_id);
|
35
|
+
```
|
1
chousei
test
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
```SQL
|
2
2
|
create table replay(
|
3
|
+
replay_id int,
|
4
|
+
player_type int,
|
5
|
+
chra_id int,
|
6
|
+
win_flag int,
|
3
|
-
|
7
|
+
unique(replay_id,player_type));
|
4
8
|
insert into replay values
|
5
9
|
(1,1,1,1),
|
6
10
|
(1,2,2,0),
|