We help IT Professionals succeed at work.

MS SQL Query + Update field from value of different table

I have two tables, both have a lenght_of_time column, and both have callID linking them.

I want to update the field in table A - length_of_time with the value in table B length_of_time where callID is equal and table B length_of_time <> 0

how would i do this - could someone help with the query

thanks
Comment
Watch Question

IT Engineer
Distinguished Expert 2017
Commented:
UPDATE TableA
SET TableA.lenght_of_time column = B.lenght_of_time column
FROM TableA A
INNER JOIN TableB B ON A.callID = B.callID

Open in new window

Author

Commented:
Thanks worked perfect