Solved

Update based on Select

Posted on 2006-07-11
2
229 Views
Last Modified: 2012-05-05
I think that this is really easy, I just have never done it before.

Basically I have a two columned table: table1

It has the columns id, and name

talble1: (all have names)
-id
-name

Then I have

table2: (Some names are null)
-id
-name

I basically want to go through table2 and for any null names use the id to look up the name in table1 and then update table2 with this name.

Thanks

~Matthew
0
Comment
Question by:Zeman4323
[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
2 Comments
 
LVL 25

Accepted Solution

by:
Mr_Peerapol earned 50 total points
ID: 17082970
UPDATE table2
SET name = b.name
FROM table2 a INNER JOIN table1 b ON a.id = b.id
WHERE a.name IS NULL
0
 

Author Comment

by:Zeman4323
ID: 17083015
Perfect!


Thanks so much
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

738 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