&& (AND) (Entity SQL)
Returns true
if both expressions are true
; otherwise, false
or NULL
.
Syntax
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 matrix shows possible input value combinations and return values.
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:
Follow the procedure in How to: Execute a Query that Returns StructuralType Results.
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