我试着使用更新设置像上面,我尝试不同的语法,但没有成功更新设置为从选择错误语法
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