I have 2 tables: progress and student. progress has fields semester,idStudent,hasFirstAttestation and hasSecondAttestation.
I need to get from progress those idStudent which have the maximum semester for student and both Attestation = 0 .
Here is an example of my query, but it is not working:
SELECT progress.idStudent FROM monitoring.progress
WHERE hasFirstAttestation = 0 AND hasSecondAttestation = 0
AND semester =
(SELECT MAX(`semester`)
FROM monitoring.progress WHERE progress.idStudent = student.idStudent);