&& (AND) (Entity SQL)

如果两个表达式均为 true,则返回 true;否则,返回 falseNULL

boolean_expression AND boolean_expression
or
boolean_expression && boolean_expression

参数

  • boolean_expression
    返回布尔值的任何有效表达式。

备注

双“与”符号 (&&) 与 AND 运算符具有相同的功能。

下表显示可能的输入值和返回类型。

TRUE FALSE NULL

TRUE

TRUE

FALSE

NULL

FALSE

FALSE

FALSE

FALSE

NULL

NULL

FALSE

NULL

示例

以下 Entity SQL 查询演示如何使用 AND 运算符。 此查询基于 AdventureWorks 销售模型。 若要编译并运行此查询,请执行下列步骤:

  1. 执行如何:执行返回 StructuralType 结果的查询 (EntityClient) 中的过程。

  2. 将以下查询作为参数传递给 ExecuteStructuralTypeQuery 方法:

-- 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

另请参见

概念

Entity SQL 参考