EXISTS (SQL Server Compact Edition)

Specifies a subquery to test for the existence of rows.

Syntax

EXISTS subquery

Arguments

  • subquery
    A restricted SELECT statement.

Result Types

bit

Return Value

Returns TRUE if a subquery contains any rows.

Example

The following example finds all orders in the Orders table, with "Washington" as the Shipping Region, for each employee listed in the Employees table.

SELECT * FROM Orders WHERE [Ship Region] = 'WA' AND EXISTS (SELECT [Employee ID] FROM Employees AS Emp WHERE Emp.[Employee ID] = Orders.[Employee ID])

Change History

Release History

5 December 2005

Changed content

Updated code