+1  A: 

Update (based on relation):

select new
{
Time = l.PeriodEndUtc,
Stat1 = (from s in l.ApplianceStatistics
         where s.ApplianceStatisticNameId == 2
         select s.Value
       ).ToList(),
Stat2 = (from s in l.ApplianceStatistics
         where s.ApplianceStatisticNameId == 3
         select s.Value
       ).ToList()
}


Try:

select new
{
Time = l.PeriodEndUtc,
Stat1 = (from s in ApplianceStatistics
                where s.ApplianceStatisticsLogId == l.ApplianceStatisticsLogId
                  &&  s.ApplianceStatisticNameId == 2
                select s.Value
       ).ToList(),
Stat2 = (from s in ApplianceStatistics
                where s.ApplianceStatisticsLogId == l.ApplianceStatisticsLogId
                  &&  s.ApplianceStatisticNameId == 3
                select s.Value
       ).ToList()
}
eglasius
Almost. Using ToList() in both subqueries still generated a roundtrip for every record in the main query result. The solution was using First() instead. I should hav mentioned that only one record should match.
BrettRobi
@brett are you sure? where you using an anonymous type on the return as in the sample? I just did some tests, and I actually can't get it to do the multiple round-trips (even without ToList - so I agree that prob has no effect) ... maybe something with the type you were assigning it to?
eglasius
I actually wasn't using an annoymous type. I just made that change to simplify my sample. Do you think projecting it as a concrete type made a difference? I never considered that could make any difference in the SQL.
BrettRobi
A: 

Freddy was on the right track and almost had it. The solution ended up being the use of First() for each subquery. As in:

from l in ApplianceStatisticsLogs
where l.ApplianceServerId > 1
orderby l.PeriodEndUtc ascending
select new
{
    Time = l.PeriodEndUtc,
    Stat1 = (from s in ApplianceStatistic
            where s.ApplianceStatisticsLogId == l.ApplianceStatisticsLogId
              &&  s.ApplianceStatisticNameId == 2
            select s.Value).First(),
    Stat2 = (from s in ApplianceStatistics
            where s.ApplianceStatisticsLogId == l.ApplianceStatisticsLogId
              &&  s.ApplianceStatisticNameId == 3
            select s.Value).First()
}

I had neglected to mention that only one record should match in the subqueries. Thanks for the help Freddy!

BrettRobi