title: SQL Server How To Use Group if there is a column with a different value?
body: <p>first take a look at my table</p>
  
  <pre><code>IDMutasi     ItemID ItemCode    ItemName    Lokasi  Seri    Quantity
  1           10      kode1       nama1       A1      001     50
  2           10      kode1       nama1       A1      002     100
  3           10      kode1       nama1       A2      001     50
  3           10      kode1       nama1       A2      003     150
  3           10      kode1       nama1       A2      003     150
  4           11      kode2       nama2       A1      011     50
  5           11      kode2       nama2       A1      011     150
  6           12      kode3       nama3       A3      012     200
  </code></pre>
  
  <p>lets just say the sql for above table is  :</p>
  
  <p><code>select * from tb_mutasi</code></p>
  
  <p>i want to make table above become like this :</p>
  
  <pre><code>ItemID  ItemCode    ItemName    Lokasi  Seri    Quantity
  10      kode1       nama1       A1      001     50
  10      kode1       nama1       A1      002     100
  10      kode1       nama1       A2      001     50
  10      kode1       nama1       A2      003     300
  11      kode2       nama2       A1      011     200
  12      kode3       nama3       A3      012     200
  </code></pre>
  
  <p>the table above shown there is no duplicate if ItemCode, Lokasi and Seri is same then the Quantity will be increased.
  for the Quantity i can get it using <code>SUM</code> but whenever i using <code>group by</code> i always get error <code>is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause</code> no matter if i use group from Seri or Lokasi, i always get that result.</p>
  
  <p>Any idea how to do that ?</p>