场景
要更新的表:t2表
取数表:t1表
一表更新另一表
方式一
—-用一表内容更新另一表,用SourceTable1更新TargetUpdateTable2
—-参考修改[]内字段表名
UPDATE TargetUpdateTable2
SET TargetUpdateTable2.[FormID] = SourceTable1.[FormID]—-待更新内容表字段取自源字段
FROM [GoldLink_Form_Values] TargetUpdateTable2—-待更新目标表
—-两表匹配条件
INNER JOIN [GoldLink_PROCESSCODE] SourceTable1 ON TargetUpdateTable2.[FTableName] = SourceTable1.[FTableName]
WHERE TargetUpdateTable2.[FormID] is null
方式二,
UPDATE T_AP_PAYBILLENTRY_B
set FFINISHTIME=(select top 1 TRANSTIME from Gold_RecBankTradeDetail where SERIALNO<>” and SERIALNO like FCHECKCODE+’%’)
where FCHECKCODE<>”
–and FID=102173
–and FENTRYID=102285
and FID in (select FId from T_AP_PAYBILL where Fdate>=’2024-10-01′)
暂无评论