回答編集履歴

3

追記

2019/05/14 08:55

投稿

sazi
sazi

スコア25195

test CHANGED
@@ -13,3 +13,25 @@
13
13
  ```
14
14
 
15
15
  [UPDATE (307P)](http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01143.1520/pdf/iqrefso_ja.pdf)
16
+
17
+
18
+
19
+ 追記
20
+
21
+ --
22
+
23
+ 相関サブクエリーとした場合
24
+
25
+ ```SQL
26
+
27
+ update tableA tgt set
28
+
29
+ receipt_key=(
30
+
31
+ select receipt_key from tableB where ymd=tgt.ymd and kigyo_cd=tgt.kigyo_cd
32
+
33
+ )
34
+
35
+ where ymd between '2019-04-16 00:00:00' and '2019-4-23 00:00:00'
36
+
37
+ ```

2

追記

2019/05/14 08:55

投稿

sazi
sazi

スコア25195

test CHANGED
@@ -11,3 +11,5 @@
11
11
  where tgt.ymd between '2019-04-16 00:00:00' and '2019-4-23 00:00:00'
12
12
 
13
13
  ```
14
+
15
+ [UPDATE (307P)](http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01143.1520/pdf/iqrefso_ja.pdf)

1

訂正

2019/05/14 08:39

投稿

sazi
sazi

スコア25195

test CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  ```SQL
4
4
 
5
- update tableA tgt set receipt_key=src.receipt_key
5
+ update tableA set tgt.receipt_key=src.receipt_key
6
6
 
7
- from tableB src
7
+ from tableA tgt join tableB src
8
8
 
9
- where tgt.ymd = src.ymd and tgt.kigyo_cd=src.kigyo_cd
9
+ on tgt.ymd = src.ymd and tgt.kigyo_cd=src.kigyo_cd
10
10
 
11
- and tgt.ymd between '2019-04-16 00:00:00' and '2019-4-23 00:00:00'
11
+ where tgt.ymd between '2019-04-16 00:00:00' and '2019-4-23 00:00:00'
12
12
 
13
13
  ```