I need to create a report of not submitted grades and fetch all data of not submitted grades.
I have two tables, tbl_college_grades and tbl_fm_college_curriculuminfo
1st table - tbl_college_grades - fetch data which have grades
2nd table - tbl_fm_college_curriculuminfo - fetch data with all subjects info
I need to hide or exclude data in tbl_fm_college_curriculuminfo in which tbl_college_grades already have.
Is there any way to achieve this?
Here is my model and query, I have tried to use NOT EXISTS but here is the error:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'EXISTS(SELECT tbl_college_grades.subCode FROM tbl_college_grades WHERE tbl_co...'
Code:
function report(){
$this->db->join('tbl_college_grades','tbl_college_grades.subCode = tbl_fm_college_curriculuminfo.subjectCode','left');
$this->db->group_by('subject');
$this->db->where('NOT EXISTS(SELECT tbl_college_grades.subCode FROM tbl_college_grades WHERE tbl_college_grades.subCode = tbl_fm_college_curriculuminfo.subjectCode)');
$query = $this->db->get('tbl_fm_college_curriculuminfo');
return $query->result_array();
}