This result should appear as follows:
This is my query: select id, name, total where student.id= marks.sutdent_id
Advertisement
Answer
You should group on the student id and name and sum the marks:
SELECT s.id, s.name, SUM(e.marks) AS total FROM student s JOIN exam e ON s.id = e.stud_id GROUP BY s.id, s.name