title: Group Employee for each Department
body: <p>I have a table <code>Details</code></p>
  
  <pre><code>DeptId        EmpID
  -------      ---------
  1             1
  1             5
  1             3
  2             8
  2             9
  </code></pre>
  
  <p>I want to group them like this:</p>
  
  <pre><code>DeptId      EmpIDs
  -------    -------
   1          1,5,3
   2          8,9
  </code></pre>
  
  <p>I want this in SQL Server. I know this can be done in MySQL using <code>Group_Concat</code> function. e.g. </p>
  
  <pre><code>SELECT DeptId, GROUP_CONCAT(EmpId SEPARATOR ',') EmpIDS
  FROM Details GROUP BY DeptId
  </code></pre>
  
  <p><a href="http://sqlfiddle.com/#!2/89baa/1" rel="nofollow">(SQL Fiddle here)</a></p>
  
  <p>But how to do this with SQL Server? I don't know any function.</p>