Performing a union in LINQ
I'm trying to get the union of these two queries but keep getting the
following error:
'System.Linq.IQueryable<AnonymousType#1>' does not contain a definition
for 'Union' and the best extension method overload
'System.Linq.ParallelEnumerable.Union<TSource>(System.Linq.ParallelQuery<TSource>,
System.Collections.Generic.IEnumerable<TSource>)' has some invalid
arguments
The linq queries look like this:
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);
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.
No comments:
Post a Comment