I have a database with tables as shown in the image. the fields under prerequisite are (pre- previous course id and following- following course id). i want to get the "following courses" list from course table where their "previous course" grade is 'F' and display them with disabled checkbox. and then show "previous courses" list with grade 'F' as checkbox. tables
I tried to join the tables like the following, but it didnt work.
SELECT
prerequisite.id,
prerequisite.following,
`result`.course_id,
`result`.grade,
`result`.approved,
`result`.student_id,
course.course_credit,
course.course_name,
course.id_course,
prerequisite.pre,
student.stu_id
FROM prerequisite
INNER JOIN `result` ON prerequisite.pre = `result`.course_id
INNER JOIN course ON course.id_course = prerequisite.pre
INNER JOIN student ON student.stu_id = `result`.student_id
WHERE (`result`.grade ='F')