回答編集履歴
1
追記
test
CHANGED
@@ -13,3 +13,19 @@
|
|
13
13
|
order by t1.id asc,t2.cd desc
|
14
14
|
|
15
15
|
```
|
16
|
+
|
17
|
+
# 追記
|
18
|
+
|
19
|
+
もしcdの最大値だけとってid順に表示したということであればこう
|
20
|
+
|
21
|
+
```SQL
|
22
|
+
|
23
|
+
select * from tableA as t1
|
24
|
+
|
25
|
+
inner join tableB as t2 on t1.id=t2.id
|
26
|
+
|
27
|
+
where not exists(select 1 from tableB where id=t2.id and cd>t2.cd)
|
28
|
+
|
29
|
+
order by t2.id asc
|
30
|
+
|
31
|
+
```
|