update query help

  • Thread starter Thread starter Me
  • Start date Start date
M

Me

I want to update table A with empid from table b. Tables a and b match with
first name and last name, I am getting operation error when I run the
following
query -

update a set empid = (select empid from b where a.firstname=b.firstname and
a.lastname=b.lastname)

I also tried -

update a set empid=b.empid
from a inner join b on (a.firstname=b.firstname and a.lastname=b.lastname)

Thank you in advance,
-Me
 
Try this --
update a inner join b on (a.firstname=b.firstname) and
(a.lastname=b.lastname) set a.empid=b.empid;
 
Back
Top