Я устанавливаю loss_dt в trans_dt, где loss_Dt >trans_Dt
.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 );