to update a table with values from another table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lunas
    New Member
    • Aug 2007
    • 4

    to update a table with values from another table

    hi
    i have to update a table based on a criteria with value selected from another table. i am writting a java progg for it . i just want to know can it be done with one statement.

    my purpose is

    result set rs =select (ID) from Tab1 where colmB is null

    LOOP rs

    select ID2 from tab2 where colC=ID

    update tab3 set colD=ID2 where colC=ID and colD is null

    end LOOP

    hope i have explained my problem clearly...
    can anyone please help me in this..
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    yes it can be easily done

    can you please post structure of both the tables involved in the update statment.

    Comment

    Working...