I am trying to get every course where the email matches a specific one from an enrollment table.
I only want to get the most recent enrollment from each course. As you can see in the image, the person who is enrolled in the HTML course, enrolled twice. Once on 2022-01-04, and once on 20221-01-07.
this query:
SELECT courseNameFk
FROM Enrollment
WHERE emailFk = 'lsmeuin9@biglobe.ne.jp'
returns every course the person has been enrolled to.
The problem is that the HTML course will occur twice in the results:
What I want is that only the most recent enrollment of each course shows up, but I have no idea how I should write the query to exclude the older enrollments.
Is there someone who can help me?