访问未包含在分组元素中的任何数据

发布于 2024-10-18 04:07:13 字数 463 浏览 2 评论 0原文

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

评论部分有问题。如何访问未包含在分组元素中的任何数据?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌路黄昏 2024-10-25 04:07:13

您需要对多个字段进行分组,然后只有您可以访问该数据。

希望

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

这会有所帮助

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文