Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT subject_mt.subject_id, student_mt.student_id,
- registration_mt.firstname, registration_mt.middlename, registration_mt.lastname,
- subject_mt.title,
- MAX(IF(g.gradingperiod_id = 7000, g.grade, ""))AS first,
- MAX(IF(g.gradingperiod_id = 7001, g.grade, "")) AS second,
- MAX(IF(g.gradingperiod_id = 7002, g.grade, "")) AS third,
- MAX(IF(g.gradingperiod_id = 7003, g.grade, "")) AS fourth,
- g.final
- FROM faculty_schedule
- INNER JOIN schedule_mt ON schedule_mt.schedule_id = faculty_schedule.schedule_id
- INNER JOIN section_mt ON section_mt.section_id = schedule_mt.section_id
- INNER JOIN section_student ON section_student.section_id = section_mt.section_id
- INNER JOIN student_mt ON student_mt.student_id = section_student.student_id
- INNER JOIN registration_mt ON registration_mt.registration_id = student_mt.registration_id
- INNER JOIN subject_mt ON subject_mt.subject_id = schedule_mt.subject_id
- INNER JOIN student_grade AS sg ON sg.student_id = student_mt.student_id
- INNER JOIN grade AS g ON g.grade_id = sg.grade_id
- //WHERE CLAUSE HERE
- GROUP BY
- subject_mt.subject_id, student_mt.student_id,
- registration_mt.firstname, registration_mt.middlename, registration_mt.lastname,
- subject_mt.title,
- g.final;
- INNER JOIN student_grade AS sg ON sg.student_id = student_mt.student_id
- INNER JOIN grade AS g ON g.grade_id = sg.grade_id
- WHERE faculty_schedule.faculty_id = pIN_facultyId
- AND schedule_mt.section_id = pIN_sectionId
- AND sg.student_id IN (SELECT student_id FROM student_grade)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement