title: Linq full outer join with NULL records C# from datatables
body: <p>Please can someone help? I need to return a table on Extn_In_Call_Records = Extn_Number and if either side does not match still return a calue just like a SQL Full Outer join. I have spent hours looking at this but cant get it to work!! I can get the code to work below if I remove the union but then it only returns matched results.  The Datatable is being populated from MYSQL. Any help woud be great.</p>
  
  <pre><code>            //Full Table
          DataTable fullext = new DataTable();
          fullext.Columns.Add("Extn_In_Call_Records", typeof(string));
          fullext.Columns.Add("Total_Calls", typeof(int));
          fullext.Columns.Add("Extn_Number", typeof(string));
          fullext.Columns.Add("Phys_Switch_Name", typeof(string));
  
  
          //End Full Table
  
  
          try
           {
  
              //Full Result
  
  
               var result = from callrc in callrecdt.AsEnumerable()
                            join physex in physextns.AsEnumerable()
                            on callrc["Extn_In_Call_Records"] equals physex["Extn_Number"]
                             .Union
                            from physex in physextns.AsEnumerable()
                            join callrc in callrecdt.AsEnumerable()
                            on physex["Extn_Number"] equals callrc["Extn_In_Call_Records"] 
  
  
  
                            select fullext.LoadDataRow(new object[] {
                         callrc["Extn_In_Call_Records"],
                         callrc["Total_Calls"],
                         physex["Extn_Number"] == null ? "" : physex["Extn_Number"],
                         physex["Phys_Switch_Name"] == null ? "" : physex["Phys_Switch_Name"]
                         }, false);
               result.CopyToDataTable();
               fullresult.DataSource = fullext;
  </code></pre>
  
  <p>Result to see</p>
  
  <pre><code>Extn_In_Call_Records    Total_Calls   Extn_Number      Phys_Switch_Name
  null                    20                0                Hospital
  null                    310               1                Hospital
  4                       132               4                Hospital
  2004                    null                null           Hospital
  2006                    2               2006           Hospital
  </code></pre>