[英]I am trying to update loss_dt in bacclaim table to trans_dt from other table bactrans on claim_id where loss_Dt >trans_dt
I am setting loss_dt to trans_dt where loss_Dt >trans_Dt
. 我将loss_dt设置为trans_dt,其中
loss_Dt >trans_Dt
。 loss_Dt
is in bacclaim
and trans_Dt
is in bactrans
both have claimid
common loss_Dt
在bacclaim
, trans_Dt
在bactrans
两者都具有共同的claimid
UPDATE bacclaim t1
SET (t1.loss_dt) = (SELECT t2.trans_dt
FROM bactrans t2
WHERE t1.claim > t2.claim)
WHERE EXISTS (
SELECT 1
FROM bactrans t2
WHERE t1.claim = t2.claim and t1.loss_dt>t2.trans_dt );
A MERGE
statement might be what you are looking for: MERGE
语句可能是您要查找的内容:
MERGE INTO bacclaim dst
USING bactrans src
ON ( src.claimid = dst.claimid )
WHEN MATCHED THEN
UPDATE SET loss_td = src.trans_dt
WHERE src.loss_td > dst.trans_dt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.