INTERSECT (Entity SQL)
INTERSECT オペランドの左右両方のクエリ式によって返される個別の値のコレクションを返します。 All expressions must be of the same type or of a common base or derived type as expression.
expression INTERSECT expression
引数
- expression
コレクションを返す任意の有効なクエリ式。もう一方のクエリ式から返されたコレクションと比較されます。
戻り値
expression と同じ型であるか、共通の基本データ型または派生型であるコレクション。
解説
INTERSECT は、Entity SQL の集合演算子の 1 つです。 Entity SQL のすべての集合演算子は左から右に評価されます。 For precedence information for the Entity SQL set operators, see EXCEPT (Entity SQL).
例
次の Entity SQL クエリでは、INTERSECT 演算子を使用して、INTERSECT オペランドの左右両方のクエリ式によって返される個別の値のコレクションを返します。 このクエリは、AdventureWorks Sales Model に基づいています。 このクエリをコンパイルして実行するには、次の手順を実行します。
Follow the procedure in StructuralType 結果を返すクエリの実行方法 (EntityClient).
Pass the following query as an argument to the
ExecuteStructuralTypeQuery
method:
(SELECT product from AdventureWorksEntities.Products as product where product.ListPrice > @price1 )
intersect (select product from AdventureWorksEntities.Products as
product where product.ListPrice > @price2)