我需要我的最终决定字段是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;
答案 0 :(得分:1)
您需要将列别名放在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;
答案 1 :(得分:0)
请尝试使用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;