Share via


|| (OR) (Entity SQL)

Combines two Boolean expressions.

boolean_expression OR boolean_expression
or 
boolean_expression || boolean_expression

Arguments

  • boolean_expression
    Any valid expression that returns a Boolean.

Return Value

true when either of the conditions is true; otherwise, false.

Remarks

OR is an Entity SQL logical operator. It is used to combine two conditions. When more than one logical operator is used in a statement, OR operators are evaluated after AND operators. However, you can change the order of evaluation by using parentheses.

Double vertical bars (||) have the same functionality as the OR operator.

The following table shows possible input values and return types.

TRUE FALSE NULL

TRUE

TRUE

TRUE

TRUE

FALSE

TRUE

FALSE

NULL

NULL

TRUE

NULL

NULL

Example

The following Entity SQL query uses the OR operator to combine two Boolean expressions. 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:

\\ OR
SELECT VALUE product FROM AdventureWorksEntities.Product 
                                    AS product where product.ListPrice = 40 OR product.ListPrice = 125
\\ || 
SELECT VALUE product FROM AdventureWorksEntities.Product 
                                    AS product where product.ListPrice = 40 || product.ListPrice = 125

This example produces the following output:

ProductID: 842
Name: Touring-Panniers, Large
ProductNumber: PA-T100
MakeFlag: False
...

See Also

Concepts

Entity SQL Reference

Other Resources

Logical Operators