我在使用LINQ完成这个任务时遇到了一些麻烦。没有太多的经验。
我有以下信息: 学校,考试,教师,学生Linq group by sub grouping
我需要的学校数量和教师对每个测试的次数的计数,但我只需要计算实例,其中老师,测试,有超过10名学生。
这里是SQL:
select
test,
count(distinct school) school_count,
count(distinct teacher) teacher_count
from
(select
test,
teacher,
school
from list
group by
test,
school,
teacher
having
count(teacher) > 10) a
group by a.test
我的结构非常简单。一个类(不是实际的代码)
class tests
{
public string teacher;
public string test;
public string school;
public string studentid;
}
然后我有一个测试列表,我正在做查询。
}
这里是一个教程,可能有助于解释如何使用“分组依据”子句 [SQL Tutorial Group By](http://beginner-sql-tutorial.com/sql-group-by-clause.htm) – MethodMan 2015-02-24 16:32:50