如果在同一行上满足几个/所有条件,我正在尝试更新列(LostRenewalCount
)的方法:
代码:
update SubmissionActivitySLXStaging
set LostRenewalCount = case
when RowSubType = 'Renewal' then '1'
when [Submission Status Code] <> 'BIN' then '1'
when dateadd (dd, 7, [Policy Effective Date]) < GETDATE()) then '1'
else '0'
end
任何建议都将不胜感激。
答案 0 :(得分:2)
我考虑根据&#34;条件&#34;制作一个更新声明。或一组条件,如下:
UPDATE SubmissionActivitySLXStaging
SET LostRenewalCount = 1
WHERE RowSubType = 'Renewal'
AND [Submission Status Code] <> 'BIN'
AND DATEADD(DD, 7, [Policy Effective Date]) < GETDATE()
之后,您可以将声明与所有其他条件一起更新&#34;条件&#34;
将它分成多个语句的原因是可读性很长!