Help needed with Update statement

  • Hi all,

    I've got two tables, staffdetails2 and staffdetails, each has  2 columns called distinguishedname and displayname, I'd like to set staffdetails2.distinguishedname to equal staffdetails.distinguishedname where staffdetails2.displayname = staffdetails2.displayname

    All help appreciated,

    JB

  • UPDATE t2

    SET distinguishedname = t1.distinguishedname

    FROM staffdetails t1 JOIN staffdetails2 t2

    ON t1.displayname = t2.displayname

    John

  • update sd2

    set sd2.distinguishedname = sd.distinguishedname

    from staffdetails2 sd2

    inner join staffdetails sd

    on sd2 = displayname = sd.displayname

  • Cheers guys!

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

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