I am using Asp.Net MVC 5 and Entity Framework 6.2.0 with LINQ Extension Methods syntax.
I have 5 tables of variants, details below:
Product Table:
Try like this;
var query = from s in YourDbContext.DbSet<ProductSKU>
join voc in YourDbContext.DbSet<ProductVariantOptionCombination> on s.SkuID equals voc.SkuID
join vo in YourDbContext.DbSet<ProductVariantOption> on voc.VariantOptionID equals vo.VariantOptionID
join v in YourDbContext.DbSet<ProductVariant> on vo.VariantID equals v.VariantID
group new {s,voc, vo, v} by s.Price
into g
select new
{
Price = g.Key,
Size = g.Max(x => x.v.Name == "Size" ? x.vo.VariantOptionName : ""),
Color = g.Max(x => x.v.Name == "Color" ? x.vo.VariantOptionName : ""),
Material = g.Max(x => x.v.Name == "Material" ? x.vo.VariantOptionName : "")
};