On Thu, Dec 16, 2004 at 01:38:19PM -0800, Benjamin Smith wrote: > 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.
If you don't mind using a non-standard construct, see the documentation for SELECT DISTINCT ON. http://www.postgresql.org/docs/7.4/static/queries-select-lists.html#QUERIES-DISTINCT http://www.postgresql.org/docs/7.4/static/sql-select.html#SQL-DISTINCT > Dates are kept as ]YYYYMMDD', eg 2004114 for Nov 14, 2004. Why not use a DATE type? You can reformat it with to_char() if need be. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly