如果兩個表達式都是 ,則傳true回 ,否則傳回 或 falseNULL。true
語法
boolean_expression AND boolean_expression
或
boolean_expression && boolean_expression
論點
boolean_expression
傳回布爾值的任何有效表達式。
備註
雙連和 (&&) 的功能與 AND 運算子相同。
下列矩陣顯示可能的輸入值組合和傳回值。
TRUE |
FALSE |
NULL |
|
|---|---|---|---|
TRUE |
是真的 | 錯誤 | 零 |
FALSE |
錯誤 | 錯誤 | 錯誤 |
NULL |
零 | 錯誤 | 零 |
範例
下列 Entity SQL 查詢示範如何使用 AND 運算符。 查詢是以 AdventureWorks 銷售模型為基礎。 若要編譯並執行此查詢,請遵循下列步驟:
遵循 如何:執行會傳回 StructuralType 結果的查詢中的程式。
將下列查詢當做自變數傳遞至
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