In Expression

In Expression is a special Boolean Expression, which can be combined with other Boolean Expression:

SelectQuery qryCustomer = OQL

  .Select(NW.Customer.CustomerID)

  .From(NW.Customer)

  .Where(NW.Customer.ContactTitle == "Owner");

 

SelectQuery qryOrder = OQL

  .SelectFrom(NW.Order)

  .Where(NW.Order.ShipVia == 1

    && NW.Order.CustomerID.In(qryCustomer));

The SQL statements generated as follows (taking SQL Server as an example)

SELECT [Orders].*

FROM [Orders]

WHERE

  [Orders].[ShipVia] = 1 AND

  [Orders].[CustomerID] IN

    (

      SELECT [Customers].[CustomerID]

      FROM [Customers]

      WHERE

        [Customers].[ContactTitle] = 'Owner'

    )

 

Related Topics

Boolean Expression