给出以下信息,如何将这2个linq查询合并为1。加入连接语句有点麻烦。将2个Linq查询合并到1中
“projectDetails”只是一个ProjectDetails的
ProjectDetails(1对多)名单PCardAuthorizations
ProjectDetails(1对多)ExpenditureDetails
通知我被同样的信息分组,并选择同一类型的信息
var pCardAccount = from c in PCardAuthorizations
where projectDetails.Contains(c.ProjectDetail)
&& c.RequestStatusId == 2
group c by new { c.ProjectDetail, c.ProgramFund } into g
select new { Key = g.Key, Sum = g.Sum(x => x.Amount) };
var expenditures = from d in ExpenditureDetails
where projectDetails.Contains(d.ProjectDetails)
&& d.Expenditures.ExpenditureTypeEnum == 0
group d by new { d.ProjectDetails, d.ProgramFunds } into g
select new {
Key = g.Key,
Sum = g.Sum(y => y.ExpenditureAmounts.FirstOrDefault(a => a.IsCurrent && !a.RequiresAudit).CommittedMonthlyRecords.ProjectedEac)
};