var result = await (from a in dbContext.Clients
join b in dbContext.Works on a.Id equals b.ClientId
where b.Price != 0
group new { a, b } by a.Name into g
select new
{
Name = g.Key,
Total = g.Sum(tot => tot.b.Price)
}).ToListAsync();;
Ok got this as:
var query = (from t in Transactions
group t by new {t.MaterialID, t.ProductID}
into grp
select new
{
grp.Key.MaterialID,
grp.Key.ProductID,
Quantity = grp.Sum(t => t.Quantity)
}).ToList();