I need to list all of the subject's "neptuncode", "subjectname" and "examdate" ordered by subjectname.
But if someone enrols the subject for the first time, I have to list (recommend them) examdate(s).
I tried this code:
SELECT neptuncode, subjectname, examdate FROM enrollments, subjects WHERE enrollments.student = (SELECT students.student_id FROM students) AND enrollments.firstenroll = 1 ORDER BY subjectname;
but it didn't work.
I attach my tables here: