Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sspydy43
Starting Member
1 Post |
Posted - 2006-07-05 : 17:19:39
|
Sorry if this is in the wrong forum, SQL is pretty new to me and I hope someone can help me with this question. I have two tables table_a and table_b. table_a has the FK app_id and table_b has the PK app_id. Table_b also has a populated field called app_name, and table_a has a newly created field called app_name with no data in it. What I need to do is create an insert statement that will look at the app_id(s) in table_b and match it/them to a app_name in table_b. I then want to take that app_name and insert it into table_a in the same row as the associated app_id. Does anyone have a script to do something like this, or can someone explain the best way to do this? Thanks for any help in advance and sorry if this does not make sense. |
|
PSamsig
Constraint Violating Yak Guru
384 Posts |
Posted - 2006-07-06 : 01:41:30
|
UPDATE a SET app_name = b.app_nameFROM table_a aINNER JOIN table_b bON b.app_id = a.app_id-- This one's tricky. You have to use calculus and imaginary numbers for this. You know, eleventeen, thirty-twelve and all those. |
 |
|
eyechart
Master Smack Fu Yak Hacker
3575 Posts |
Posted - 2006-07-06 : 04:28:54
|
Just a friendly word of advice - make sure you have a good backup prior to doing something like this...-ec |
 |
|
|
|
|