title: Best way to merge two DataTables sorted, without duplicate rows? (C#)
body: <p>I have two DataTables (DataTableA and DataTableB) like following: (Assume that each line is each DataRow. Also I added an underscore just to make it look nice. Underscores aren't included in the actual data.</p>
  
  <p><strong>DataTableA</strong> <br></p>
  
  <pre><code>CategoryA | *blank* | *blank* | *blank* | ... 
  Michael __|  24  __ | _31    _| _ 21_   | ... 
  Tony  ____| _29  __ | _28    _| _ 19_   | ... 
  CategoryB | *blank* | *blank* | *blank* | ... 
  John  ____| _12  __ | _31    _| _ 25_   | ... 
  CategoryC | *blank* | *blank* | *blank* | ... 
  ...
  </code></pre>
  
  <p><strong>DataTableB</strong> <br></p>
  
  <pre><code>CategoryA   | *blank* | *blank* | *blank* | ... 
  Jessica ____| _35  __ | _35 _   | _ 35_   | ... 
  CategoryB   | *blank* | *blank* | *blank* | ... 
  Michaela  __| _10  __ | _11 _   | _ 12_   | ... 
  Miranda   __| 25   __ | _25 _   | _ 25_   | ... 
  CategoryC   | *blank* | *blank* | *blank* | ... 
  ...
  </code></pre>
  
  <p>Now I need to combine them and the final product has to be like: </p>
  
  <p><strong>DataTableC</strong></p>
  
  <pre><code>CategoryA   | *blank* | *blank* | *blank* | ... 
  Michael   __| 24  __  | _31 _   | _ 21_   | ... 
  Tony    ____| _29  __ | _28 _   | _ 19_   | ... 
  Jessica ____| _35  __ | _35 _   | _ 35_   | ... 
  CategoryB   | *blank* | *blank* | *blank* | ... 
  John ____   | _12  __ | _31 _   | _ 25_   | ... 
  Michaela __ | _10  __ | _11 _   | _ 12_   | ... 
  Miranda __  | 25  __  | _25 _   | _ 25_   | ... 
  CategoryC   | *blank* | *blank* | *blank* | ... 
  </code></pre>
  
  <p>As you can see, the data from DataTableB has to come after the data of DataTableA.
  Also, the category rows shouldn't be duplicated.</p>
  
  <p>I got them merged using DataTable.Merge() method, but now it looks like two DataTables just combined back to back, and it has the duplicate category rows too.
  I am wanting to use .Join method somehow, to sort them and put data together, but I am not quite sure how to go about it.</p>
  
  <p>I thought about using loops too, adding a row at a time into a DataTable object, but this is cumbersome, and I thought there should be an easier way than that.
  Could someone give me advice?</p>