title: Using distinct with stuff/for xml path('')
body: <p>I'd like to put together only unique values in the concatenated string.  My code is currently:</p>
  <pre><code>select rc.Routage
      , COUNT(distinct rc.Event)
      , STUFF((select ', ' + cast(rcA.Event as varchar)
              from Receiving rcA
              where rcA.supplier = 'user'
              for xml path(''))
          , 1, 1, '')
  from Receiving rc
  where rc.supplier = 'user'
  group by rc.Routage
  order by COUNT(distinct rc.Event)desc
  </code></pre>
  <p>This gives me the output I'd expect, but I would like to eliminate the duplicate values in the stuff/for xml path field.</p>
  <p>I've tried various combinations of <code>distinct</code> and <code>group by</code> in the stuff/xml section, but can't piece it together properly.</p>
  <p>To clarify, for <code>COUNT(distinct rc.Event)</code> = 2, I would like to see 2 distinct events from the stuff clause.  How can I do this?</p>