title: Performing a union in LINQ
body: <p>I'm trying to get the union of these two queries but keep getting the following error:</p>
  
  <pre><code>'System.Linq.IQueryable&lt;AnonymousType#1&gt;' does not contain a definition for 'Union' and    the best extension method overload 'System.Linq.ParallelEnumerable.Union&lt;TSource&gt;(System.Linq.ParallelQuery&lt;TSource&gt;, System.Collections.Generic.IEnumerable&lt;TSource&gt;)' has some invalid arguments
  </code></pre>
  
  <p>The linq queries look like this:</p>
  
  <pre><code>var g = from p in context.APP_PROD_COMP_tbl
          where p.FAM_MFG == fam_mfg
          group p by new
          {
              a_B_G = p.B_G,
              a_MFG = p.MFG,
              a_PRODUCT_FAM = p.PRODUCT_FAM,
          };
  
  var q = from p in context.APP_COMP_tbl
          where p.FAM_MFG == fam_mfg
          group p by new
          {
  
              a_B_G = p.a_B_G,
              a_MFG = p.a_MFG,
              a_PRODUCT_FAM = p.a_PRODUCT_FAM,
  
          };
  
  var data = q.Union(g);
  </code></pre>
  
  <p>I've tried using IEnumerable around the queries, but it still didn't work. Not really sure where I'm going wrong at this point, although admittedly LINQ isn't something I've had a ton of exposure to.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>So I've gone in a slightly different direction from what I posted earlier. After doing more research, the <code>group by</code> statements were from old code and no longer needed for the intended purpose. I changed those to <code>select new</code> statements and had no further issue with the union.</p>