Reputation: 6605
I need my Final Decision field to be the result of the IIF statement.
But I keep getting syntax errors.
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;
Upvotes: 1
Views: 4799
Reputation: 23228
Try using ISNULL instead:
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;
Upvotes: 0
Reputation: 26654
You need to put the column alias at the end of the IIF
statement and put []
around it
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;
Upvotes: 1