Tsql 合并多个更新查询
如何组合这两个查询(使用交叉表和条件进行更新),以减少在宏中使用多个查询的需要 问题1Tsql 合并多个更新查询,tsql,updates,Tsql,Updates,如何组合这两个查询(使用交叉表和条件进行更新),以减少在宏中使用多个查询的需要 问题1 UPDATE [Master Output Table], [Input table] SET [Master Output Table].[Area Change Ar Transfer From] = [Input table]![Amount 1723] WHERE ((([Input table]![Transaction Type 1723])="Area Change Ar Transfer Fr
UPDATE [Master Output Table], [Input table] SET [Master Output Table].[Area Change Ar Transfer From] = [Input table]![Amount 1723]
WHERE ((([Input table]![Transaction Type 1723])="Area Change Ar Transfer From") AND (([Master Output Table]![Transaction Type])="Amount 1723"));
问题2
UPDATE [Master Output Table], [Input table] SET [Master Output Table].[Area Change Ar Transfer From] = [Input table]![Tax Amount 1723]
WHERE ((([Input table]![Transaction Type 1723])="Area Change Ar Transfer From") AND (([Master Output Table]![Transaction Type])="Tax Amount 1723"));
这应该对你有用
UPDATE [Master Output Table], [Input table]
SET
[Master Output Table].[Area Change Ar Transfer From] =
case when [Master Output Table]![Transaction Type]="Amount 1723" then
[Input table]![Amount 1723]
else
[Input table]![Tax Amount 1723]
end
WHERE
[Input table]![Transaction Type 1723]="Area Change Ar Transfer From"
AND
[Master Output Table]![Transaction Type] in ("Amount 1723","Tax Amount 1723");
我得到一个语法错误(缺少运算符),它似乎与以“case-when”开头的部分有关