回答編集履歴
2
修正
answer
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
「同じIDで登録された最新のCDのデータ」というを解釈しました。
|
1
|
+
「同じIDで登録されたものの内の最新のCDのデータ」というを解釈しました。
|
2
2
|
相関副問合せで、同じIDで最大のCDを条件とします
|
3
3
|
```SQL
|
4
4
|
select *
|
1
修正
answer
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
select *
|
5
5
|
from tableb as tb left join tablea as ta
|
6
6
|
on tb.id=ta.id
|
7
|
-
where not exists
|
7
|
+
where not exists(select 1 from tableb where id=tb.id and cd > tb.cd)
|
8
8
|
order by tb.id, tb.cd
|
9
9
|
```
|
10
10
|
または
|