如何为多个数字范围返回布尔值?

时间:2015-05-14 20:38:44

标签: sql ms-access categorical-data iif

我正在尝试使用IIF函数在Access '13中的make表查询中创建一个虚拟变量,我遇到了一些关于如何构造范围的问题。

基本上,我在表格中有三列分类数据,数字范围是1到9,对应于我的数据。如果所有三列的值都在4到9之间,我想返回一个布尔值。

这是我尝试过的,它返回一个包含所有真值的列,我知道并非如此。 nonmetro:

IIf((4>=[Beale All Versions Together]![1983 Rural-urban Continuum Code]<=9) 
And (4>=[Beale All Versions Together]![1993 Rural-urban Continuum Code]<=9)
And (4>=[Beale All Versions Together]![2003 Rural-urban Continuum Code]<=9),1,0)

1 个答案:

答案 0 :(得分:1)

您可以为表达式使用逻辑:

CodesAre4To9:
[Beale All Versions Together]![1983 Rural-urban Continuum Code] Between 4 And 9 
And 
[Beale All Versions Together]![1993 Rural-urban Continuum Code] Between 4 And 9 
And 
[Beale All Versions Together]![2003 Rural-urban Continuum Code] Between 4 And 9