Export (0) Print
Expand All

Intersect

SQL Server 2000

Intersect

Returns the intersection of two input sets, optionally retaining duplicates.

Syntax

Intersect(«Set1», «Set2»[, ALL])

Remarks

This function returns the intersection of «Set1» and «Set2». By default, duplicates are eliminated from both sets prior to intersection.

The optional ALL retains duplicates. There are several ways for ALL to work. The algorithm is: Nonduplicated elements are intersected as usual. For each duplicate in «Set1», match it with a duplicate in «Set2», if one exists, and keep matching duplicates in the intersected set.

Example

This example

Intersect({[1994], [1995], [1996]}, {[1995], [1996], [1997]})

returns the set {[1995], [1996]}.

Show:
© 2014 Microsoft