www.cryer.co.uk
Brian Cryer's Web Resources

iif

iif
Immediate If. An database function, provided on many (but not all) database systems that returns one of two values depending on a supplied condition. It takes the form:

iif(condition,true-result,false-result)

The expression returns the "true-result" if the "condition" evaluates to true, if the condition evaluates to "false" then the "false-result" is returned. For example:

select hour, iif(hour>=12,"pm","am") from log

will return a result set with the hour and an "am" or "pm" indicator (assuming that table log contains a field "hour" containing the hour of some event).