Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lookup data in one table and move to another 1

Status
Not open for further replies.

WaveOut

Programmer
Sep 6, 2002
42
US
I need help with the following:

I have two tables. The first table, Craft_temp, contains the following fields:

craftID craft_group craft_name craft_cateogry
1 1 Carpenter A Carpenter
2 2 Carpenter B Carpenter
3 1 Electrician A Electrician


My other table, Craft, contains the following fields:

craftID craft_group craft_name craft_cateogry
1 Null Carpenter A Carpenter
2 Null Carpenter B Carpenter
3 Null Electrician A Electrician


My goal is to get rid of the Null's in the craft_group field. I'm thinking I need to lookup the craft_name in the craft_temp table and get the craft_group and copy it to the craft table. I'm just not sure how to write this in sql. Any help is appreciated.

Thanks,
Dave
 
UPDATE a
SET a.craft_group = b.craft_group
FROM Craft a, Craft_temp b
WHERE a.craftID = b.craftID
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top