Condividi tramite


AND (&&) (Entity SQL)

Restituisce true se entrambe le espressioni sono true; in caso contrario, restituisce false o NULL.

boolean_expression AND boolean_expression
or
boolean_expression && boolean_expression

Argomenti

  • boolean_expression
    Qualsiasi espressione valida che restituisce un valore Boolean.

Osservazioni

L'utilizzo di due caratteri di e commerciale (&&) ha la stessa funzionalità dell'operatore AND.

Nella tabella seguente sono inclusi i possibili valori di input e i tipi restituiti.

TRUE FALSE NULL

TRUE

TRUE

FALSE

NULL

FALSE

FALSE

FALSE

FALSE

NULL

NULL

FALSE

NULL

Esempio

Nella query Entity SQL seguente viene illustrato come utilizzare l'operatore AND. La query è basata sul modello Sales di AdventureWorks. Per compilare ed eseguire questa query, effettuare le operazioni seguenti:

  1. Seguire la procedura indicata in Procedura: eseguire una query che restituisce risultati StructuralType (EntityClient).

  2. Passare la query seguente come argomento al metodo ExecuteStructuralTypeQuery:

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

Di seguito viene riportato l'output:

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

Vedere anche

Concetti

Operatori logici (Entity SQL)
Riferimenti a Entity SQL