回答編集履歴
1
update
test
CHANGED
@@ -21,3 +21,29 @@
|
|
21
21
|
;
|
22
22
|
|
23
23
|
```
|
24
|
+
|
25
|
+
簡単な名前・距離指定から
|
26
|
+
|
27
|
+
```sql
|
28
|
+
|
29
|
+
update table_A t0,
|
30
|
+
|
31
|
+
(select t1.* from table_B t1 join
|
32
|
+
|
33
|
+
(select name, kyori, min(record) record from table_B group by 1,2) t2
|
34
|
+
|
35
|
+
on t1.name=t2.name and t1.record=t2.record and t1.kyori=t2.kyori
|
36
|
+
|
37
|
+
) t3
|
38
|
+
|
39
|
+
set t0.record=t3.record, t0.day=t3.day
|
40
|
+
|
41
|
+
where t0.name=t3.name and t0.kyori=t3.kyori
|
42
|
+
|
43
|
+
and t0.record>t3.record
|
44
|
+
|
45
|
+
and (t0.name,t0.kyori)=('佐藤 太朗','100M')
|
46
|
+
|
47
|
+
;
|
48
|
+
|
49
|
+
```
|