update column from another table

rgb192
rgb192 used Ask the Experts™
on
i want orderitems.sku to get values from orderitems123.sku

varchar(25) column
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Do you have a Key on these tables to join?


update ord1
   set sku= ord2.sku
  from orderimtes ord1 inner join orditmes123 ord2 on ord1.key = ord2.key

lcohanDatabase Analyst
Commented:
That should be something like below but as "sventhan" mentioned you need to match the rows between the two tables on a id key column

update orderitems set sku = orderitems123.sku
from orderitems123
where orderitems.id = orderitems123.id

Author

Commented:
thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial