0

我正在尝试将两个更新查询组合成一个 sql 语句。我以为我可以使用联合查询来组合查询,但我做不到。有什么建议吗?我要组合的查询如下:

UPDATE PromotionDatabase
  SET PromotionDatabase.PromotionWeekEndingSunday = [PromotionDatabase]![Start Date]+-(Weekday([PromotionDatabase]![Start Date])-1)+7 

UPDATE PromotionDatabase
  SET PromotionDatabase.PromotionEndingWeekEndingSunday = [PromotionDatabase]![End Date]+-(Weekday([PromotionDatabase]![End Date])-1)+7;
4

2 回答 2

0

您是否只是想在同一个 UPDATE 语句中更新 2 个字段:

UPDATE PromotionDatabase
SET PromotionWeekEndingSunday = [Start Date]+-(Weekday([Start Date])-1)+7,
   PromotionEndingWeekEndingSunday = [End Date]+-(Weekday([End Date])-1)+7;
于 2013-03-22T23:37:56.177 回答
0

更新的语法如下。见w3schools

UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value
于 2013-03-23T01:20:04.130 回答