开发者

Access any data that is not contained in grouped element

开发者 https://www.devze.com 2023-02-12 01:51 出处:网络
from teamBudget in TeamBudgets where teamBudget.TeamID == 71002 join teamBroker in TeamBrokers on 71002 equals teamBroker.TeamID
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)
}

Commented part is a problem. How to access any data that is not contained in grouped element?


you need to Group multiple fields then only you can access that data.

like

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 };

Hope this will help

0

精彩评论

暂无评论...
验证码 换一张
取 消