我有这个 CASE 语句,我需要在 Access 中转换为 IIF:
Case When sfrstcr_pidm is not null Then 'A' WHen sfrstcr_pidm <> '' Then 'A' Else Null End as StudentStatus,
这是转换为 IIF 的正确方法吗?
IIF ([sfrstcr_pidm] is not null, ‘A’, IIF([sfrstcr_pidm] <> ‘’, ‘A’, Null))
我有这个 CASE 语句,我需要在 Access 中转换为 IIF:
Case When sfrstcr_pidm is not null Then 'A' WHen sfrstcr_pidm <> '' Then 'A' Else Null End as StudentStatus,
这是转换为 IIF 的正确方法吗?
IIF ([sfrstcr_pidm] is not null, ‘A’, IIF([sfrstcr_pidm] <> ‘’, ‘A’, Null))
将Case
语句转换为 Access SQL 最明显的方法是使用Switch
函数。这需要多个参数,并使用if
…………逻辑then
。elseif
它没有else
选项,但elseif true
可以解决这个问题。
使用此函数,您的代码将变为以下内容:
Switch(sfrstcr_pidm is not null, 'A', sfrstcr_pidm <> '', 'A', True, Null)