I have two separate tables with the following data. I know finding the elements with the max value in a field is a common question, but I haven't found a way to do this in my situation where the data is spread over two tables.
Enrollment Table:
StudentID CourseID Section_Key Date_Added
Section Table:
SectionID Period
What I'm trying to do is show an entire student's schedule, but remove older courses that have been dropped. The Enrollment table includes courses that have been dropped so I want to only show the most recently added course for each Period.
For example, say there is a student with the following classes in their schedule:
CourseID Section_Key Period Date_Added
2503F 123456 1 2018-05-13
9990 245678 1 2018-08-01
I only want it to show the second course above in the results. I would also like the results sorted by Period.