任何机构都可以建议如何将以下 4 个更新语句制作为单个更新语句。
update dbo.FACOD set LowValue ='07/02/2010' where Fieldname in ('AYStartDate','Dateloanstart')and AwardYear='2012-13'
update dbo.FACOD set LowValue ='07/02/2011' where Fieldname in ('AYStartDate','Dateloanstart')and AwardYear='2013-14'
update dbo.FACOD set HighValue='06/30/2015' where Fieldname in ('AYEndDate','DateloanEnd')and AwardYear='2012-13'
update dbo.FACOD set HighValue='06/30/2016' where Fieldname in ('AYEndDate','DateloanEnd')and AwardYear='2013-14'
尝试以下一个
UPDATE dbo.FACOD
SET LowValue = CASE WHEN Fieldname in ('AYStartDate','Dateloanstart')and AwardYear='2012-13' THEN '07/02/2010' ELSE LowValue END,
HighValue = CASE WHEN Fieldname in ('AYEndDate','DateloanEnd')and AwardYear='2012-13'THEN '06/30/2015'ELSE HighValue END,
但这并不能满足所有更新声明。