Sdílet prostřednictvím


&& (AND)

Returns true if both expressions are true; otherwise, false or NULL.

boolean_expression AND boolean_expression
or
boolean_expression && boolean_expression

Arguments

  • boolean_expression
    Any valid expression that returns a Boolean.

Remarks

Double ampersands (&&) have the same functionality as the AND operator.

The following table shows possible input values and return types.

TRUE FALSE NULL

TRUE

TRUE

FALSE

NULL

FALSE

FALSE

FALSE

FALSE

NULL

NULL

FALSE

NULL

Example

The following Entity SQL query demonstrates how to use the AND operator. The query is based on the AdventureWorks Sales Model. To compile and run this query, follow these steps:

  1. Follow the procedure in How to: Execute a Query that Returns StructuralType Results.

  2. Pass the following query as an argument to the ExecuteStructuralTypeQuery method:

-- AND
SELECT VALUE product FROM AdventureWorksEntities.Products 
    AS product where product.ListPrice >  @price1 AND product.ListPrice <  @price2
-- && 
SELECT VALUE product FROM AdventureWorksEntities.Products 
    AS product where product.ListPrice > @price1 && product.ListPrice < @price2

See Also

Concepts

Entity SQL Reference