Set Theory.
From SQL BOL:
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]}.
----------------------------------------------------------------------
So, if you are using tables, an inner join will do the same thing (same as the ALL) option above. If you want want distinct values, then use the DISTINCT keyword.
USE pubs
SELECT DISTINCT authors.city
FROM authors INNER JOIN publishers
ON authors.city = publishers.city