• Let's back up a second then. I want to translate the SELECT shown above to an UPDATE statement. I want to update m1 balanceOutstanding  expressed as:

    -- add +value row to -value row for NetBalance

    m1.BalanceOutstanding = m1.balanceoutstanding + m2.balanceoutstanding
    -- and 
    m2.BalanceOutstanding = 0

    Can anyone help with that? This stuff works in MySQL, and I'm trying to make it work SQL Server.

    Here's the SELECT again:

    SELECT m1.notenumber, m1.balanceoutstanding, m2.notenumber, m2.balanceoutstanding, m1.balanceoutstanding + m2.balanceoutstanding as NetBal FROM RelatedParticipationLoans AS r
    INNER JOIN MasterLoandata AS m1 ON r.RelatedNotenumber = m1.Notenumber AND m1.bankid = 508 and m1.clientid = 441 AND m1.import_asofdate = '2012-01-31'
    INNER JOIN MasterLoandata AS m2 ON r.SoldNotenumber = m2.Notenumber and m2.bankid = 508 AND m2.clientid = 441 AND m2.import_asofdate = '2012-01-31'
    WHERE NOT m1.balanceoutstanding + m2.balanceoutstanding < 0