我正在研究基于php mysql的学校数据库系统。基本结构如下:
Table Class-Details of all classes.
Table Student-Details of all students
Table Semester-Details of all Semesters
Table class–Semester. This table solves many to many relation, primary key- IDs of both class and semester.
Table Subject -Details of all Subjects
Table class–Subject. This table solves many to many relation, primary key- IDs of both class and semester.
Table marks- consists of student ID, Subject ID, Semester ID, Marks Achieved.Foreign Key ClassID, SemesterID, SubjectID
我试图以下面提到的格式获得一个表格:
ENGINE = InnoDB
AUTO_INCREMENT = 53
DEFAULT CHARACTER SET = utf8;
到目前为止,我可以在每个记录中获得单独的主题标记 我的疑问:
SELECT
m.MarkID, m.studentID,
sm.ExamName, sb.Subject,
sm.MaxMarks, m.MarksRecvd
FROM marks AS m
RIGHT JOIN student AS st
ON m.studentID=st.studentID
RIGHT JOIN semester AS sm
ON m.ExamID=sm.ExamID
RIGHT JOIN subject AS sb
ON m.SubjectID=sb.SubjectID
WHERE m.studentID = $studentID
请帮我解决这个问题...我正在为每个标记recvd记录如下。
但是我想将所有学期标记分组在一行中,如下所示:
朋友请告诉我,如果我的查询是明确的