Using SQL Server
How can this be done:
In all rows in the top table PS_CA_BILL_PLAN we want to update field LAST_XREF_SEQ_NUM with the MAX(XREF_SEQ_NUM)+1 from the bottom table
Where the CONTRACT_NUM and BILL_PLAN_ID are equal
This SQL below (in green) works for one row only
