可能重复:
Oracle - 使用内部连接更新语句
在 SQL Server Developer Edition 中,我想用另一个表中的值和变量来更新列。
表中sa_tran_item
,ref_no6
字段显示"NYN"
,其他表apo_rms_i_item_place
,SORTIMENTSGRUPP_KOD
字段显示10
我想更新表sa_tran_item
,ref_no6
字段为"NYN10"
我的查询
UPDATE sa_tran_item
SET ref_no6 = "ref_no6" + "a.SORTIMENTSGRUPP_KOD"
FROM apo_rms_i_item_place a, sa_tran_item
WHERE a.varnummer in (select item from item_master where item_number_type='MANL' and PRIMARY_REF_ITEM_IND = 'Y' and item_parent in
(select ITEM from sa_tran_item where error_ind = 'Y' and tran_seq_no in
(select tran_seq_no from sa_error where tran_seq_in ='49910349001' error_code like 'ACG_NOT_FOUND') ));