C# LINQ查询返回列表的列表
我有一个问题:C# LINQ查询返回列表的列表,c#,linq,linq-to-sql,C#,Linq,Linq To Sql,我有一个问题: from m in dc.ReportingMonths where m.Month.Value == month select (from k in m.KPI_Actives where k.DateActive.Year == year select (from r in dc.ReportingViews where r.KPIID == k.KPIID select r) ); 显然,因为它
from m in dc.ReportingMonths
where m.Month.Value == month
select (from k in m.KPI_Actives
where k.DateActive.Year == year
select (from r in dc.ReportingViews
where r.KPIID == k.KPIID select r)
);
显然,因为它是嵌套的LINQ查询——每个查询返回一个iQueryTable,所以我得到了一组iQueryTables
如何编写一个类似的查询,只返回一个简单的ReportingView列表作为最后一个查询的返回,而不使用foreach循环创建一个新列表
谢谢 类似于:
from m in dc.ReportingMonths where m.Month.Value == month
from k in m.KPI_Actives
where k.DateActive.Year == year
from r in dc.ReportingViews
where r.KPIID == k.KPIID
select r;
?类似于:
from m in dc.ReportingMonths where m.Month.Value == month
from k in m.KPI_Actives
where k.DateActive.Year == year
from r in dc.ReportingViews
where r.KPIID == k.KPIID
select r;
?谢谢!没有意识到我可以做到这一点,没有选择的声明在每一点。谢谢!我不知道如果没有select语句,我可以做到这一点。