title: Determining items that join against the same set in T-SQL
body: <p>I am writing a a report and was wondering if there is there any way to find items that join into identical sets?</p>
  
  <p>For example in the following query, I want to find all areas that join against the same set of products: </p>
  
  <pre><code>SELECT Area.Name, AggregateSetOfProductsId
  FROM Area
  INNER JOIN AreaToProduct ON AreaToProduct.AreaId = Area.Id
  GROUP BY Area.Id
  </code></pre>
  
  <p>The current best solution that I could think of was writing a custom aggregate that hashed the ProductId uniqueidentifiers together (something like shift right based on some byte then xor them together) it but I figured I'd ask if there was an easier way before going through it. </p>