ALL or ANY Conditions

Use ALL or ANY conditions in subqueries in search conditions.

The syntax for ALL conditions is:

expression compare ALLsubquery )

where compare is a comparison operator.

The syntax for ANY conditions is:

expression compare ANYsubquery )

where compare is a comparison operator.

For example, an ANY condition with an equality operator is TRUE if expression is equal to any of the values in the result of the subquery, and FALSE if the expression is not NULL and does not equal any of the columns of the subquery:

expression = ANYsubquery )

The ANY condition is UNKNOWN if expression is the NULL value, unless the result of the subquery has no rows, in which case the condition is always FALSE.

You can use the keyword SOME instead of ANY.

Restrictions

If there is more than one expression on either side of a quantified comparison predicate, an error message is returned. For example:
Subquery allowed only one select list item

Queries of this type can always be expressed in terms of IN subqueries or scalar subqueries using MIN and MAX set functions.

Compatibility

ANY and ALL subqueries are compatible between Adaptive Server Enterprise and Sybase IQ. Only Sybase IQ supports SOME as a synonym for ANY.