For a survey website I've written this query to show the survey results, with a percentage for each chosen answer:SurveyResultViewModel srvm =    (from s in _context.Surveys        where s.Id == id        select new SurveyResultViewModel        {            Title = s.Title,            ResponseCount = s.Results.Count,            Questions = from q in s.Questions                select new QuestionResultViewModel                {                    Text = q.Text,                    Answers = from a in q.Answers                        select new AnswerResultViewModel                        {                            Text = a.Text,                            SelectedCount = a.Results.Count,                            SelectedPercentage =                             (double)a.Results.Count / q.Answers.Select(an => an.Results.Count).Sum()                        }                }        }).Single();                                                                              However, I do think it can be improved, just not sure how. It runs 4 queries for every question in the survey because of the line that calculates the percentage.
Efficiency of a linq query on a nested structure
c#;linq;linq to sql