Solved

sql update

Posted on 2011-03-22
3
289 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

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Help - 12 60
all records from previous month 6 45
SQL Server stored proc 2 13
Trying to identify overlapping date ranges 5 16
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

920 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

12 Experts available now in Live!

Get 1:1 Help Now