我有以下
客户1-许多客户地址
客户1-许多客户电话
我想根据CustomerCalls中列的值更新CustomerAddresses。如下所示:
Update CustomerAddresses
Set CustomerAddresses.PostCode = 'xxx'
Where CustomerCalls.CallType = 'x'
答案 0 :(得分:2)
您可以在更新语句中使用from
子句,允许您也使用连接。像这样的东西应该做的伎俩(虽然我不得不猜测列名......)
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'