我有树桌:
表A:ID(PK),X,Y
表B:ID(非PK),CID
表C:ID(PK),X,Y和(B.ID = C.ID)
和---条件---> A.X = C.X And A.Y = C.Y
我如何设置B.CID = C.ID?
答案 0 :(得分:0)
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