我有一个疑问:
SELECT students.rollno, students.name, COUNT( sp.paperid ) AS papers
FROM sps sp
LEFT JOIN students ON students.studentid = sp.studentid
LEFT JOIN str st ON st.studentid = sp.studentid
LEFT JOIN iars ir ON ir.paperid = sp.paperid
LEFT JOIN attndata at ON at.iarsid = ir.id
LEFT JOIN hedata he ON he.iarsid = ir.id
LEFT JOIN assigndata asg ON asg.iarsid = ir.id
WHERE sp.studentid = at.studentid
AND sp.studentid = asg.studentid
AND sp.studentid = he.studentid
AND students.course =4
AND st.semesterid =1
AND st.sessionid =12
AND students.status = 'Regular'
GROUP BY students.rollno
我有一个数据库,其中有学生数据,即他们的论文、个人数据、出勤率、作业、考试数据。我想计算表中有数据的论文数量,例如 attndata 即出勤,assigndata 即分配和 hedata 即考试,sps 表具有学生正在学习的 paperid,str 表与学生学期相关。请帮助获得正确的论文数量。
谢谢。