I had the 1nd statement in my code and found it not giving an accurate count, it was returning 1 when the correct answer is 18. To try and debug the problem I broke it out creating the 2nd statement here and the count returns 18. I just don't see what the difference is between these two. It seems like the 1st is just more compact.
I'm currently running these two statements back to back and I'm sure that the database isn't changing between the two.
int count = (from s in surveysThisQuarter
where s.FacilityID == facility.LocationID
select s.Deficiencies).Count();
vs
var tempSurveys = from s in surveysThisQuarter
where s.FacilityID == facility.LocationID
select s;
int count = 0;
foreach (Survey s in tempSurveys)
count += s.Deficiencies.Count();