Udostępnij za pośrednictwem


&& (AND) (Entity SQL)

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 (EntityClient).

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

// AND
SELECT VALUE product FROM AdventureWorksEntities.Product 
    AS product where product.ListPrice > 10 AND product.ListPrice < 20
// && 
SELECT VALUE product FROM AdventureWorksEntities.Product 
    AS product where product.ListPrice > 10 && product.ListPrice < 20

The output is shown below:

ProductID: 844
Name: Minipump
ProductNumber: PU-0452
MakeFlag: False
ProductID: 846
Name: Taillights - Battery-Powered
ProductNumber: LT-T990
MakeFlag: False

See Also

Concepts

Entity SQL Reference

Other Resources

Logical Operators