sql update

SQL DB Tables as follows:

TABLE-1
TB1_ID
TB1_Label

TABLE-2
TB2_ID
TB2_Label


How would I write a sql script to update the TB1_Label with TB2_Label -- when TB1_ID == TB2_ID ?
amillyardAsked:
Who is Participating?
 
Ephraim WangoyaConnect With a Mentor Commented:
update Table-1
set  TB1_Label = (select TB2_Labe2 from TABLE-2 where TABLE-2.TB2_ID= TABLE-1.TB1_ID)
0
 
chapmandewCommented:
update t1
set tb1_label = t2.tb2_label
from table1 t1
join table2 t2 on t1.id = t2.id
0
 
amillyardAuthor Commented:
thank you - very clear formatting
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.