我还是SQL新手。
我有一个查询来计算参加某个讲座的学生人数,我一直试图通过讲座对记录进行分组,所以我没有10个同一个讲座的记录。
SELECT ATTENDANCESHEET.LECTUREID,TOPIC, (
SELECT COUNT(STUDENTID) AS ATTENDANCE
FROM ATTENDANCESHEET
WHERE ATTENDANCESHEET.STUDENTID = LECTURE.STUDENTID
)
FROM ATTENDANCESHEET,LECTURE
WHERE ATTENDANCESHEET.LECTUREID = LECTURE.LECTUREID
GROUP BY ATTENDANCESHEET.LECTUREID;
我收到错误“不是GROUP BY表达式”。请有人帮帮我吗?