In Operator (SQL Only)

See AlsovboprInOperatorSee


Determines whether the value of an expression is equal to any of several values in a specified list.  This operator can only be used within SQL statements29F05E5.


expr [Not] In (value1, value2,  . . .)


The In operator uses the following arguments.

Argument        Description


expr                 Expression identifying the field that contains the data you want to evaluate

value1, value2  Expression or list of expressions against which you want to evaluate expr


If expr is found in the list of values, the In operator returns True; otherwise, it returns False.  You can include the Not logical operator to evaluate the opposite condition (that is, whether expr is not in the list of values).

You might use In to determine whether the value of a control is in a set of specified regions.  The following example shows how you can tell if an order is shipped to a western region.  If the State is WA, CA, or OR, the IIf function returns "West".  Otherwise, it returns "Non-West".

Select IIf([State] In ('WA','CA','OR'), "West", "Non-West")
From Publishers


If expr or any of the entries in the list of values is Null, In returns a Null.