I want to retrieve all records from table 'A' and I want to add another field from another table, 'B' in that query result.
This is what I have so far but it's not working right:
SELECT Students.ID, Students.StudentName, MarkingDetails.MarkingID, Students.ClassID, MarkingDetails.Grade, MarkingDetails.StudentID
FROM Students LEFT JOIN MarkingDetails ON Students.ID = MarkingDetails.StudentID
WHERE (((MarkingDetails.MarkingID) Is Null Or (MarkingDetails.MarkingID)=1) AND ((Students.ClassID)=1));
Basically what I would like is to get all the students and if the student exists in the second table, filtered by classid and markingid, get the grade.