Hi i am trying to do SCD-2 type logic in a db2 merge statement.

That is..update the old record's end_eff_dt as the existing rows max(eff_dt)-1
and update the new record's end_eff_dt to 2999-12-31. Can anyone help me out here? Thanks!