views:

58

answers:

1

I have a query:

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

Obviously, because it is nested LINQ queries - each returning an IQueryable I get a set of IQueryables as a result.

How do I write a similar query that instead just returns a single flat list of ReportingViews (as the last query returns) without using foreach loops to create a new list?

Thanks!

+5  A: 

Something like:

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;

?

Marc Gravell
Thanks! Didn't realise I could do that without the select statements at every point.
Elliot Hughes