我有三个表:
表A: ID(PK), X, Y表B: ID(Not PK), CID
表C: ID(PK), X, Yand (B.ID = C.ID)and——Condition——> A.X = C.X And A.Y = C.Y
如何设置B.CID = C.ID?
UPDATE B
SET CID = C.ID
FROM dbo.TableA A
JOIN dbo.TableC C ON A.X = C.X AND A.Y = C.Y
JOIN dbo.TableB B ON B.ID = C.ID