Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. SELECT subject_mt.subject_id, student_mt.student_id,
  2. registration_mt.firstname, registration_mt.middlename, registration_mt.lastname,
  3. subject_mt.title,
  4. MAX(IF(g.gradingperiod_id = 7000, g.grade, ""))AS first,
  5. MAX(IF(g.gradingperiod_id = 7001, g.grade, "")) AS second,
  6. MAX(IF(g.gradingperiod_id = 7002, g.grade, "")) AS third,
  7. MAX(IF(g.gradingperiod_id = 7003, g.grade, "")) AS fourth,
  8. g.final
  9.  
  10. FROM faculty_schedule
  11. INNER JOIN schedule_mt ON schedule_mt.schedule_id = faculty_schedule.schedule_id
  12. INNER JOIN section_mt ON section_mt.section_id = schedule_mt.section_id
  13. INNER JOIN section_student ON section_student.section_id = section_mt.section_id
  14. INNER JOIN student_mt ON student_mt.student_id = section_student.student_id
  15. INNER JOIN registration_mt ON registration_mt.registration_id = student_mt.registration_id
  16. INNER JOIN subject_mt ON subject_mt.subject_id = schedule_mt.subject_id
  17. INNER JOIN student_grade AS sg ON sg.student_id = student_mt.student_id
  18. INNER JOIN grade AS g ON g.grade_id = sg.grade_id
  19.  
  20.  
  21. //WHERE CLAUSE HERE
  22.  
  23. GROUP BY
  24. subject_mt.subject_id, student_mt.student_id,
  25. registration_mt.firstname, registration_mt.middlename, registration_mt.lastname,
  26. subject_mt.title,
  27. g.final;
  28.  
  29. INNER JOIN student_grade AS sg ON sg.student_id = student_mt.student_id
  30. INNER JOIN grade AS g ON g.grade_id = sg.grade_id
  31.  
  32. WHERE faculty_schedule.faculty_id = pIN_facultyId
  33. AND schedule_mt.section_id = pIN_sectionId
  34. AND sg.student_id IN (SELECT student_id FROM student_grade)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement