Solved

sql update

Posted on 2011-03-22
3
287 Views
Last Modified: 2012-05-11
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 ?
0
Comment
Question by:amillyard
3 Comments
 
LVL 60

Expert Comment

by:chapmandew
ID: 35192495
update t1
set tb1_label = t2.tb2_label
from table1 t1
join table2 t2 on t1.id = t2.id
0
 
LVL 32

Accepted Solution

by:
ewangoya earned 500 total points
ID: 35192501
update Table-1
set  TB1_Label = (select TB2_Labe2 from TABLE-2 where TABLE-2.TB2_ID= TABLE-1.TB1_ID)
0
 

Author Closing Comment

by:amillyard
ID: 35192649
thank you - very clear formatting
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now