Solved

Update based on Select

Posted on 2006-07-11
2
224 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 50 total points
Comment Utility
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
Comment Utility
Perfect!


Thanks so much
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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…
Viewers will learn how the fundamental information of how to create a table.

728 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

14 Experts available now in Live!

Get 1:1 Help Now