回答編集履歴
5
推敲
test
CHANGED
@@ -4,7 +4,13 @@
|
|
4
4
|
|
5
5
|
select * from tbl
|
6
6
|
|
7
|
+
where (id, `code`) not in (
|
8
|
+
|
9
|
+
select id, max(`code`) from tbl group by id
|
10
|
+
|
11
|
+
)
|
12
|
+
|
7
|
-
|
13
|
+
and id not in (
|
8
14
|
|
9
15
|
select id from tbl
|
10
16
|
|
@@ -20,10 +26,4 @@
|
|
20
26
|
|
21
27
|
)
|
22
28
|
|
23
|
-
and (id, `code`) not in (
|
24
|
-
|
25
|
-
select id, max(`code`) from tbl group by id
|
26
|
-
|
27
|
-
)
|
28
|
-
|
29
29
|
```
|
4
訂正
test
CHANGED
@@ -20,4 +20,10 @@
|
|
20
20
|
|
21
21
|
)
|
22
22
|
|
23
|
+
and (id, `code`) not in (
|
24
|
+
|
25
|
+
select id, max(`code`) from tbl group by id
|
26
|
+
|
27
|
+
)
|
28
|
+
|
23
29
|
```
|
3
訂正
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
id毎の最大`
|
1
|
+
id毎の最大`code`を除いたものの、最大と最小の`time`に、指定した時刻が含まれる`ID`でないもの。
|
2
2
|
|
3
3
|
```SQL
|
4
4
|
|
@@ -8,9 +8,9 @@
|
|
8
8
|
|
9
9
|
select id from tbl
|
10
10
|
|
11
|
-
where (id, `
|
11
|
+
where (id, `code`) not in (
|
12
12
|
|
13
|
-
select id, max(`
|
13
|
+
select id, max(`code`) from tbl group by id
|
14
14
|
|
15
15
|
)
|
16
16
|
|
2
変更
test
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
id毎の最大`time`を除いたものの、最大と最小の`time`に、指定した時刻が含まれる`ID`でないもの。
|
2
|
+
|
1
3
|
```SQL
|
2
4
|
|
3
5
|
select * from tbl
|
@@ -6,10 +8,16 @@
|
|
6
8
|
|
7
9
|
select id from tbl
|
8
10
|
|
11
|
+
where (id, `time`) not in (
|
12
|
+
|
13
|
+
select id, max(`time`) from tbl group by id
|
14
|
+
|
15
|
+
)
|
16
|
+
|
9
17
|
group by id
|
10
18
|
|
11
19
|
having '11:30' between min(`time`) and max(`time`)
|
12
20
|
|
13
|
-
)
|
21
|
+
)
|
14
22
|
|
15
23
|
```
|
1
推敲
test
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
group by id
|
10
10
|
|
11
|
-
having '11:30' between min(time) and max(time)
|
11
|
+
having '11:30' between min(`time`) and max(`time`)
|
12
12
|
|
13
13
|
)
|
14
14
|
|