Reputation: 3449
Here's the scenario:
TABLE 1 (client table. imported into sql server via a csv file)
column 1 column2
Cust ID value
TABLE 2 (my table)
column 1 column2
Record ID value
TABLE 3 (my table)
column 1 column2
Record ID Cust ID
How do I update "value"/column 2 in table 2, given the "value" in table 1 that has only Cust ID (and not Record ID)?
I know some kind of join has to happen with tables 2 and 3, but how do I accomplish this?
Upvotes: 0
Views: 786
Reputation: 1673
Update TableTwo
set TableTwo.column2 = TableOne.column2
FROM TableOne
Join TableThree on TableOne.column1 = TableThree.column2
Join TableTwo on TableTwo.column1 = TableThree.column1
Basically that is it.
You can refer to MSDN here.
Upvotes: 3