title: Datatable group by sum
body: <p>in a Queue i have datatables in the following format</p>
  
  <pre><code>some table in the Queue
      Name Rank
      AAA  9 
      BBB  5
      CCC  1
      DDD  5
  
  some other table in the Queue
      Name Rank
      AAA  1 
      SSS  5
      MMM  1
      DDD  8
  </code></pre>
  
  <p>using LINQ need to process those tables table by table continously and add the results to a global DataTable in the following format:</p>
  
  <pre><code>Name  Rank1  Rank2  Rank3  Rank&gt;3
  AAA   1      0      0      1
  BBB   0      0      0      1
  CCC   1      0      0      0
  DDD   0      0      0      2
  SSS   0      0      0      1
  MMM   0      0      0      0
  </code></pre>
  
  <p>in the global table 4 columns state how many times a name was ranked in ranks 1,2,3 or >3.</p>
  
  <p>now if the name already exists in global table i will not add it but only increment the rank count columns, and if does not exist then add it.</p>
  
  <p>i've done this with nested looping but i wonder if anyone can help me with the LINQ syntax to do such thing,also will using LINQ make the process faster than with nested looping?</p>
  
  <p>note that new tables are added to the Queue every second and i will be getting sometable from the Queue and process it to the global datatable</p>