title: Tsql Pivot on string + concat
body: <p>I'm having some difficulties with a Pivot query for my particular situation.
  I have to Pivot a string column over an int column (so just 2 columns)
  The third column will hold a concatenation of the strings</p>
  
  <pre><code>Example:
  CustomerID   Breed
  --------------------------
  1            Pug
  1            Bulldog
  1            Doberman
  2            Doberman
  3            Bulldog
  3            Doberman
  3            Pug
  3            Poedel
  
  
  Result:    
  CustomerID  Pug    Bulldog    Doberman    Poodle    Concat
  -----------------------------------------------------------------------------
  1           Pug    Bulldog    Doberman    NULL      Pug,Bulldog,Doberman
  2           NULL   NULL       Doberman    NULL      Doberman
  3           Pug    Bulldog    Doberman    Poodle    Pug,Bulldog,Doberman,Poodle
  </code></pre>
  
  <p>I have tried the methods described in following post:
  <a href="https://stackoverflow.com/questions/24470/sql-server-pivot-examples">SQL Server: Examples of PIVOTing String data</a></p>
  
  <p>But this just returns NULL's everywhere, i'm guessing it's because of my ID column.</p>
  
  <p>Any and all help is greatly appreciated.</p>