Thanks, Jeff, for this great article.
I have one small editorial comment.
In the section Filtering for "2" Products, the query is the one below:
--===== Find Customers that bought either "A" OR "B"
-- and count the DISTINCT number of products each bought.
-- The filter in the WHERE clause causes an error here.
WHERE ProductCode IN ('A','B')
AND COUNT(DISTINCT ProductCode) = 2
GROUP BY CustomerID
The error is supposed to be Msg 147, Level 15, State 1, Line 1.... But the error returned when the code above is run is:
Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'FROM'.
Because, I think, of the comma after CustomerID in the SELECT clause.
Not a huge deal, but given how precise your articles and comments are, I think it will help those following the steps.
Thanks as always for such detailed and informative work!!