title: Sql Server - Get Ids of summed rows
body: <p>I have the following table t_vouchers:</p>
  
  <pre><code>id  code  amount  isactive
  1   a1    10      1
  2   a2    20      0
  3   a3    30      1
  </code></pre>
  
  <p>I want to compute the sum(amount) of all active vouchers but also get another column containing the list of ids included in this sum. Like below:</p>
  
  <pre><code>sum   ids
  40    1,3
  </code></pre>
  
  <p>The query would be something like:</p>
  
  <pre><code> select sum(amount) /* ? how to get here the ids stuffed in a comma separated string ? */
   from t_vouchers
   where isactive = 1
  </code></pre>