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 |
|
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2010-05-13 : 15:43:15
|
| I have a table called WeeklyDiaries that has the field HUN in it.I want to add the Hun field to the Alldiaries field. I created the field already now ready to add the data. I can join both tables on weeklyid. How would I write this? |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-05-13 : 15:47:07
|
Some sample data will help...but looks like this.UPDATE aSET a.Hun = b.Hunfrom Alldiaries a inner join WeeklyDiaries b on a.weeklyid = b.weeklyid |
 |
|
|
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2010-05-13 : 16:03:42
|
Thanks!Alldiaries dataWeeklyID drycde drydat HUN 0 MR NULL NULL 1 MR NULL NULL 2 D1 NULL NULL 3 B9 9/18/2006 NULL 4 MR NULL NULL 5 B9 3/28/2006 NULL WeeklyDiaries Table dataWeeklyID hun 0 07611 1 32122 2 40628 3 41755 I |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-05-13 : 16:05:43
|
| The query I gave should work for you, no? |
 |
|
|
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2010-05-13 : 16:06:42
|
| Yes it did thank you!!! |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-05-13 : 16:07:41
|
| Np. You're welcome. |
 |
|
|
|
|
|