An if/then/else expression may not be used within queries. Consider using either an if/then expression, or use a sequence ...