SQL:在MS Access中将IIF与CASE语句一起使用以填充列

时间:2019-05-15 23:05:58

标签: sql ms-access

我想知道在编写用于MS Access的SQL代码时如何或是否可以在CASE语句中使用IIF语句。我正在尝试根据其他列的输入填充单个列。

我已经通过编写以下代码并研究了如何在MS Access中使用CASE语句来进行尝试。

RE020_STATUS: 
CASE 
WHEN IIf([03_RE]![RE060_ACTUAL] Is Null,"Pending RE060",IIf([03_RE]![RE097_ACTUAL] Is Null,"Pending RE097",IIf([04_CI001_CI091]![CI050_ACTUAL] Is Null,"Pending CI050",IIf([04_CI001_CI091]![CI081_ACTUAL] Is Null,"Pending CI081",IIf([01_JobDetails_JI_CL]![CL001_ACTUAL] Is Null,"Pending CL001",IIf([01_JobDetails_JI_CL]![CL100_ACTUAL] Is Null,"Pending CL100",IIf([05_CI093_CI164]![CI139_ACTUAL] Is Null,"Pending CI139",IIf([05_CI093_CI164]![CI140_ACTUAL] Is Null,"Pending CI140","Pending CL101")))))))) 
WHEN IIf([03_RE]![RE020_FORECAST] Is Null,IIf([01_JobDetails_JI_CL]![CL001_ACTUAL] Is Null,"Pending CL001",IIf([01_JobDetails_JI_CL]![CL100_ACTUAL] Is Null,"Pending CL100",IIf([05_CI093_CI164]![CI139_ACTUAL] Is Null,"Pending CI139",IIf([05_CI093_CI164]![CI140_ACTUAL] Is Null,"Pending CI140","Pending CL101"))))) 
END

到目前为止,我所得到的只是关于代码编写方式的错误,我缺少操作数,表达式或语句。

0 个答案:

没有答案