Benjamin Smith <lists(at)benjamindsmith(dot)com> writes:
> I have a list of students, and a list of enrollment records, and I'm trying to
> get a list of students and their most recent enrollment/disenrollment dates.
I don't know any nice way to solve this type of problem in bog-standard SQL.
But it's pretty easy to solve using Postgres' DISTINCT ON extension.
Look at the "weather reports" example in the SELECT reference page
for inspiration.
regards, tom lane