尝试在MS Access中创建案例语句时出错

时间:2019-06-06 20:39:52

标签: sql vba ms-access

查询表达式中出现语法错误(缺少运算符),我怎么了?

SELECT
    ExportUF_NEW.Position, 
    ExportUF_NEW.[User Defined Field 03]
    (CASE
        WHEN ExportUF_NEW.[User Defined Field 03] = OP THEN "Production"
        WHEN ExportUF_NEW.[User Defined Field 03] = STM THEN "Thermal"
        ELSE NULL
    END) AS OperationGroup
FROM ExportUF_NEW
    WHERE (((ExportUF_NEW.[User Defined Field 03]) Is Not Null))

基于ExportUF_NEW [用户定义的字段03],将结果预期到新列“ OperationGroup”中。

1 个答案:

答案 0 :(得分:0)

MS Access不支持CASE WHEN,请改用switch。 相似链接:What is the equivalent of Select Case in Access SQL?