title: Types don't match between the anchor and the recursive part in column "ProductNames" of recursive query "CTE"
body: <pre><code>With CTE as
  (
    Select ProductCategoryId,
           Count(*) [Count], 
           Max(ProductName) ProductNames, 
           0 [Rank] 
    From Product 
    Group By ProductCategoryId 
  
    Union ALL 
  
    Select CTE.ProductCategoryId,
           CTE.[Count], 
           ProductNames + N' , ' + ProductName, 
           [Rank]+1 
    From 
      CTE inner join Product 
        on CTE.ProductCategoryId = Product.ProductCategoryId 
        and CTE.ProductNames Not Like '%'+ProductName+'%' 
        and CTE.[Rank] &lt; cte.[Count]
  )
  Select ProductCategoryId,
         Max(ProductNames) ProductNames,
         Max([Count]) [Count] 
  From CTE 
  Group by ProductCategoryId 
  order by ProductCategoryId
  </code></pre>