Switch语句返回0

时间:2016-10-11 13:16:56

标签: switch-statement ms-access-2013

为什么我的switch语句为所有匹配的值返回0而不是" switch"值?如果它不是匹配的值,则返回空白,这是正确的。

这是我的语法,看起来对我的新手眼睛有效

SELECT [ICC]=Switch([ICC]="UV1","RP1",[ICC]="UV2","RP2",[ICC]="UV3","RP3") AS Expr1
FROM UVMaster;

1 个答案:

答案 0 :(得分:0)

删除Switch Statment开头的[ICC] =。它应该如下所示。无法回答为什么它返回零,但这应该解决它。

SELECT Switch([ICC]="UV1","RP1",[ICC]="UV2","RP2",[ICC]="UV3","RP3") AS Expr1
FROM UVMaster;