我正在尝试更新表中的记录,这需要我使用 INNER JOIN 来查找正确的记录。
SELECT T2.*
FROM Schema.Table2 T2 INNER JOIN
Schema.Table1 T1 ON T2.Key_Column = T1.Key_Column
WHERE T2.ID = @ID AND T1.Code = '1'
试过了
UPDATE Schema.Table2 T2
SET T2.col1 = @Var1,
T2.col2 = @Var2,
T2.col3 = @Var3
WHERE T2.Key_Column = (SELECT T2.*
FROM Schema.Table2 T2 INNER JOIN
Schema.Table1 T1 ON T2.Key_Column = T1.Key_Column
WHERE T2.ID = @ID AND T1.Code = '1')
请帮忙!