Reputation: 3536
I have the following
Customers 1-Many CustomerAddresses
Customers 1-Many CustomerCalls
I want to update CustomerAddresses based on the value in a column in CustomerCalls. Something like the following:
Update CustomerAddresses
Set CustomerAddresses.PostCode = 'xxx'
Where CustomerCalls.CallType = 'x'
Upvotes: 0
Views: 311
Reputation: 82474
You can use a from
clause in your update statement, allowing you to also use joins. Something like this should do the trick (though I had to guess the column names...)
UPDATE CustomerAddresses
SET CustomerAddresses.PostCode = 'xxx'
FROM CustomerAddresses
INNER JOIN Customers ON Customers.Address = CustomerAddresses.AddressId
INNER JOIN CustomerCalls ON Customers.Calls = CustomerCalls.CallId
WHERE CustomerCalls.CallType = 'x'
Upvotes: 2