Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Update based on Select

Posted on 2006-07-11
2
Medium Priority
?
237 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
2 Comments
 
LVL 25

Accepted Solution

by:
Mr_Peerapol earned 200 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

783 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