scalar-expression comparison-operator SOME (subquery)
|scalar-expression||A scalar expression (most commonly a data column) whose values are being compared with the result set generated by subquery.|
|comparison-operator||One of the following comparison operators: = (equal to), <> or != (not equal to), < (less than), <= (less than or equal to), > (greater than), >= (greater than or equal to), [ (contains), or ] (follows).|
|subquery||A subquery, enclosed in parentheses, which returns a result set that is used for the comparison with scalar-expression.|
The SOME keyword works in conjunction with a comparison operator to create a predicate (a quantified comparison condition) that is true if the value of a scalar expression matches one or more of the corresponding values retrieved by the subquery. The SOME predicate compares a single scalar-expression item with a single subquery SELECT item. A subquery with more than one select item generates an SQLCODE -10 error.
The SOME and ANY keywords are synonyms.
The following example selects those employees with salaries greater than $75,000 that live in any of the states west of the Mississippi River:
SELECT Name,Salary,Home_State FROM Sample.Employee WHERE Salary > 75000 AND Home_State = SOME (SELECT State FROM Sample.USZipCode WHERE Longitude < -93) ORDER BY Home_State