Linq 访问分组元素中不包含的任何数据
注释部分是一个问题。如何访问分组元素中未包含的任何数据?您需要将多个字段分组,然后只有您才能访问该数据 像 希望这会有所帮助Linq 访问分组元素中不包含的任何数据,linq,join,linq-group,Linq,Join,Linq Group,注释部分是一个问题。如何访问分组元素中未包含的任何数据?您需要将多个字段分组,然后只有您才能访问该数据 像 希望这会有所帮助 from teamBudget in TeamBudgets where teamBudget.TeamID == 71002 join teamBroker in TeamBrokers on 71002 equals teamBroker.TeamID join goal in Goals on teamBroker.GlobalBrokerID equals goa
from teamBudget in TeamBudgets
where teamBudget.TeamID == 71002
join teamBroker in TeamBrokers on 71002 equals teamBroker.TeamID
join goal in Goals on teamBroker.GlobalBrokerID equals goal.GlobalBrokerID
group goal by goal.GlobalBrokerID into g
select new
{
// TeamID=teamBroker.TeamID,
// MTDGoal=teamBudget.Sum(t => t.Budget),
RevenueMTDCurrent = g.Sum(x => x.RevenueMTDCurrent)
}
var result = from i in
(from uh in db.UserHistories
where uh.User.UserID == UserID && uh.CRMEntityID == (int)entity
select new { uh.ActionID, uh.ActionType, uh.ObjectID })
group i by new { i.ActionID, i.ActionType, i.ObjectID } into g
select new { g.ActionID, g.ActionType, g.ObjectID };