我試着使用更新設置像上面,我嘗試不同的語法,但沒有成功更新設置爲從選擇錯誤語法
update
pc_discount
set
ceza_ucret_turu_id=pc_discount_ceza.CEZA_ALT_UCRET_KODU
from
(select CEZA_ALT_UCRET_KODU from pc_discount_ceza where CEZA_ALT_UCRET_KODU is not null) pdc
where
pc_discount.id=pdc.discount_id
ceza_ucret_turu_id is null
第一次沒有成功(SQL命令未正確結束)
MERGE INTO pc_discount pd
USING pc_discount_ceza pdc
ON pd.id = pdc.discount_id
AND pdc.CEZA_ALT_UCRET_KODU is not null
and pd.ceza_ucret_turu_id is null
WHEN MATCHED THEN
UPDATE
SET ceza_ucret_turu_id = pdc.CEZA_ALT_UCRET_KODU
再次失敗(缺少ON關鍵字)
是否有任何建議來運行那種sql?
編輯:
update
pc_discount
set
ceza_ucret_turu_id=pdc.CEZA_ALT_UCRET_KODU
from
(select CEZA_ALT_UCRET_KODU from pc_discount_ceza where CEZA_ALT_UCRET_KODU is not null) pdc
where
pc_discount.id=pdc.discount_id and
ceza_ucret_turu_id is null
依然沒有改變。
沒有子查詢返回任何結果從pc_discount_ceza'選擇CEZA_ALT_UCRET_KODU CEZA_ALT_UCRET_KODU不爲空嗎? –
是許多結果。 – Furkan