所有學生痕我有3個表student_register, subject, marks
有student_register_id
顯示與主題列 標記表中的所有學生的痕跡,subject_id
我要顯示在表格式輸出告訴我MySQL查詢。PHP:顯示與主題列
Studentid StudentName Sub1的分公司2 Sub3中Sub4中SUB5 Sub6劃Outof
1 Akash 75 80 82 86 70 71 100
2 Amit 92 87 89 93 65 82 100
我的查詢是
SELECT DISTINCT student_register.student_register_id,student_register.student_first_name, student_register.stud_l_name, subject.subject_name, subject.subject_id, marks.marks_obtain,marks.outof, marks.status
FROM student_register
INNER JOIN marks ON marks.student_register_id=student_register.student_register_id
INNER JOIN subject ON marks.subject_id=subject.subject_id
INNER JOIN class_teacher ON class_teacher.division_id = student_register.division_id AND class_teacher.class_teacher_id = '".$_SESSION['class_teacher_id']."'";
它給了我輸出
Studentid StudentName Sub1的分公司2 Sub3中Sub4中SUB5 Sub6劃Outof
1 Akash 71 100
2 Akash 92 100
3 Akash 93 100
4 Amit 98 100
5 Amit 89 100
請分享你的表結構 –
我想對於這一點,你必須做一些PHP代碼來設置所需的表 – Priyank
學生{Studentid ,StudentName,...} subject {Subjectid,SubjectName,...} marks {studentid,Subjectid,mark,...} 與上述結構相同。 – Vaishali