Level 58
You can use the join method to join the subjects and students tables to the internal_marks table. You can also use the whereRaw method to format the query as desired.
DB::table("internal_marks AS InternalMark")
->select('Student.registerno', 'Student.name', 'Subject.subject_code', 'Subject.subject_name')
->join('subjects AS Subject', 'InternalMark.subject_id', '=', 'Subject.id')
->join('students AS Student', 'InternalMark.student_id', '=', 'Student.id')
->whereNotIn('InternalMark.id', function ($q) {
$q->select('internalmarks_id')
->from('internal_mark_entries')
->whereNotIn('internal_mark_entries.entry_id', function ($q1) {
$q1->select('id')
->from('internal_mark_entry_nos');
});
})
->where('exammonth_id', '=', session('ExamID'))
->whereRaw('InternalMark.subject_id = Subject.id AND InternalMark.student_id = Student.id')
->get();