我正在尝试计算每年唯一出现的教师。我确信结果不是唯一的。
我的查询
SELECT DISTINCT count (tblTeachers.TeacherID) AS uniqueTeacherCount, tblSchoolYears.SchoolYear
FROM tblTeachers INNER JOIN tblTeacher_Building
.
.
GROUP BY tblSchoolYears.SchoolYear
ORDER BY tblSchoolYears.SchoolYear DESC;
结果(计算 TeacherID 的重复项)
我也试过
SELECT COUNT(DISTINCT tblTeachers.TeacherID) AS uniqueTeacherCount, tblSchoolYears.SchoolYear
FROM tblTeachers INNER JOIN tblTeacher_Building
.
.
GROUP BY tblSchoolYears.SchoolYear
ORDER BY tblSchoolYears.SchoolYear DESC;
我错过了什么?
谢谢