Description
Returns the value from true_expression or false_expression based on a condition.
Returns the value from the true_expression if boolean_expression returns true, or returns the value from the false_expression if boolean_expression returns false. The true_expression and the false_expression must return the same type.
Syntax
IIF (boolean_expression, true_expression,
false_expression )
Arguments
boolean_expression is a condition expression that returns a boolean value. If null is returned, it is treated as false.
true_expression is an expression, its value will be returned when the value of boolean_expression is true.
false_expression is an expression, its value will be returned when the value of boolean_expression is false.
Examples
SELECT Country, IIF ( (Pop_1994 > 100000000), 'Large', IIF ( (Pop_1994 < 10000000), 'Small', 'Medium') )
AS Size from "/Samples/NamedTables/WorldTable" WHERE country in ('Canada','Vietnam','Brazil','China','Japan')