Export (0) Print
Expand All
Expand Minimize

SOME | ANY (SQL Server Compact)

Compares a scalar value with a single-column set of values.


scalar_expression { = | < > | ! = | > | > = | ! > | < | < = | ! < } 
   { SOME | ANY } (subquery )

scalar_expression

Any valid expression in Microsoft SQL Server Compact.

{ = | <> | != | > | >= | !> | < | <= | !< }

Any valid comparison operator.

SOME | ANY

Specifies that a comparison should be made.

subquery

A subquery that has a result set of one column. The data type of the column returned must be the same data type as scalar_expression.

SOME or ANY returns TRUE when the comparison specified is TRUE for ANY pair (scalar_expression, x) where x is a value in the single-column set. Otherwise, returns FALSE.

ONE can be used with the SOME or ANY arguments.

-- This example queries for Employee ID values greater than 13.
-- The query locates some matching values,
-- a result of True is returned, with a list of the
-- matching Employee records.
SELECT *
FROM Employees
WHERE (0 < ANY
      (SELECT [Employee ID]
      FROM Employees AS Employees_1
      WHERE ([Employee ID] > 13)));

-- This example queries for Employee ID values greater than 15.
-- Because no matching values are found, a result of False is
-- returned and no records are displayed.
SELECT *
FROM Employees
WHERE (0 < ANY
      (SELECT [Employee ID]
      FROM Employees AS Employees_1
      WHERE ([Employee ID] > 15)));
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft