回答編集履歴
1
追記
test
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
COPYしたテーブルの最終更新日時以降に、変更のあった元テーブルのデータを抽出したいって事だと思うので
|
2
|
+
|
3
|
+
※追加も考慮
|
2
4
|
|
3
5
|
```SQL
|
4
6
|
|
@@ -10,12 +12,16 @@
|
|
10
12
|
|
11
13
|
where カラムX >(select max(カラムx) from テーブルCopyA where カラム1=A.カラム1)
|
12
14
|
|
15
|
+
or not exists(select 1 from テーブルCopyA where カラム1=A.カラム1)
|
16
|
+
|
13
17
|
) tA RIGHT JOIN (
|
14
18
|
|
15
19
|
select * from テーブルB as B
|
16
20
|
|
17
21
|
where カラムX >(select max(カラムx) from テーブルCopyB where カラム1=B.カラム1)
|
18
22
|
|
23
|
+
or not exists(select 1 from テーブルCopyB where カラム1=B.カラム1)
|
24
|
+
|
19
25
|
) as tb
|
20
26
|
|
21
27
|
ON tB.カラム1 = tA.カラム1
|