help with UPDATE SELECT statement

  • Does anyone know how to write this Oracle update statement for SQL Server? I can't seem to find a way to get this done without writing two update statements.

    update testtab set (obd,vrd) =

    (select sum(ob_oblig), sum(ob_vchrd)

    from s_obl_bal

    where ob_fund = '796');

  • I'm not an Oracle guy, so I do not completely understand what the posted statement is supposed to do. Can you post your two TSQL Update statements?



    Once you understand the BITs, all the pieces come together

  • I'm not an Oracle guy either, but did you mean this?

    update testtab

    set obd = b.ob_oblig,

    vrd = b.ob_vchrd

    from (select sum(ob_oblig) as ob_oblig,

    sum(ob_vchrd) as ob_vchrd

    from s_obl_bal

    where ob_fund = '796') as b

  • That's it! Thank you very much!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply