My SQL query is:
UPDATE REGISTRUDENT set qual=1 WHERE studentolevelsubjects AS sls INNER JOIN courserequirements AS csreq ON sls.subject_id = csreq.subject_id WHERE sls.stud_id = '$stud_id' AND sls.grade_id>=csreq.min_grade AND sls.examno = '$examno' AND csreq.course_id = '$course_id'

I'm having issue comparing two different table to get if a registrant qualified based on the course requirement I need help

course requirement table
shot1.jpg

The subject passed by the student in exams
shot2.jpg

I intend updating and setting the qual =1 if the student qualifies

Many Thanks

this is an updated query:
UPDATE REGISTRUDENT rs
JOIN studentolevelsubjects sls ON sls.some_column = rs.some_column //missing this JOIN
JOIN courserequirements csreq ON sls.subject_id = csreq.subject_id
AND sls.grade_id >= csreq.min_grade
WHERE sls.stud_id = '$stud_id'
AND sls.examno = '$examno'
AND csreq.course_id = '$course_id'
SET rs.qual = 1;
but I want the query to ensure the student meets all the subjects requirement before update

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.