Solved

sql update

Posted on 2011-03-22
3
294 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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:
Ephraim Wangoya 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
In this article I will describe the Detach & Attach 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.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

628 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