update by joining table

  • i have 2 tables

    in table1 fields are sno,phonenum,name

    in table2 fields are sno and phonenum

    i want to update phonenum in table1 with phonenum in table2 curresponding to sno

    how can i write a single query to update phonenum in table1 by joins or anyother way

    can anybody help me

  • Try: -

    update t1

    set

    t1.phonenum = t2.phonenum

    from

    table1 t1 inner join table2 t2 on t1.sno = t2.sno

    Regards,

    Andy Jones

    .

Viewing 2 posts - 1 through 1 (of 1 total)

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