The query works fine, as it is, at least in my layout, which I just threw together ... maybe this has something to do with how the database is structured ... In my layout, I have studentID as foreign the key to the StudInDepartment table (ha!), and even this simplified query works fine
var deptRpt2 = from d in ctx.StudInDepartment group d by d.DeptId into grp select new { Dept = grp.Key, AverageMarks = grp.Average(ed=>ed.StudentTb.Marks) };
The message you received "function timeout" may be a Visual Studio debugging problem, cannot help you there, theres other threads from stackoverflow that discuss this as well.
source share