I have two tables called students
and marks
. I have data in these tables like below
students
id name
232 James Gordon
353 Mark Gordon
marks
id total
232 70
In my query below, i am trying to fetch all students who have no marks yet but i am getting all students from the code below. How do i join the table to get this done.
I am newbie to php and mysql. Thank you
Student Controller
public function getForMarks($class,$session)
{
$students= Student::selectRaw("regiNo,CAST(rollNo AS SIGNED) as rollNo,firstName,lastName")
->where('class','=',$class)
->where('section','=',$section)
->where('shift','=',$shift)
->where('session','=',$session)
->orderBy('rollNo','asc')->get();
return $students;
}