我需要我的最终决策字段是IIF语句的结果。
但是我一直收到语法错误。
SELECT x.AR_ID,
Final Decision: IIf([x].[R_DECISION] Is Not Null,
[R_DECISION],
IIf([ap_decsion] Is Not Null,
[ap_decsion],
IIf([ho_decision] Is Not Null,
[ho_decision],[ar_decision])
)
) FROM x;发布于 2011-07-29 21:43:14
您需要将列别名放在IIF语句的末尾,并用[]将其括起来
SELECT x.AR_ID,
IIf([x].[R_DECISION] Is Not Null,
[R_DECISION],
IIf([ap_decsion] Is Not Null,
[ap_decsion],
IIf([ho_decision] Is Not Null,
[ho_decision],
[ar_decision]))) as [Final Decision:]
FROM x;发布于 2011-07-29 21:44:11
尝试使用ISNULL:
SELECT x.AR_ID, Final Decision: IIf(NOT ISNULL([x].[R_DECISION]),[R_DECISION],IIf(NOT ISNULL([ap_decsion]),[ap_decsion],IIf(NOT ISNULL([ho_decision]),[ho_decision],[ar_decision]))) FROM x;
https://stackoverflow.com/questions/6874048
复制相似问题