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 |
|
LarryOwen
Starting Member
2 Posts |
Posted - 2006-06-14 : 07:58:11
|
| Hi,Is it possible to update a field in sql server 2000 sp3 based on a join to another table.Here is the situation, I have 2 tables, A & B. they both have text fields named AccountNum & Service_Type. I would like to join table A to table B based on the AccountNum field, then Update A.Service_Type from the values in B.Service_Type.This is pretty simple to do in Access but I cant seem to get it to work on SQL. Any help would be very much appreciated.Thank you |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2006-06-14 : 08:07:20
|
| The general syntax isUPDATE yourtable SET yourtable.blah = othertable.blah FROM yourtable JOIN othertable ON col = col-------Moo. :) |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-06-14 : 08:11:40
|
quote: Originally posted by mr_mist The general syntax isUPDATE yourtable SET yourtable.blah = othertable.blah FROM yourtable JOIN othertable ON col = col-------Moo. :)
UPDATE yourtable SET yourtable.blah = othertable.blah FROM yourtable JOIN othertable ON yourtable.col = othertable.colOtherwise the query processor will generate an error.Peter LarssonHelsingborg, Sweden |
 |
|
|
LarryOwen
Starting Member
2 Posts |
Posted - 2006-06-14 : 08:16:07
|
| that worked, thanks alot to both of you. |
 |
|
|
|
|
|