Returning latest/highest record from a set of records
A common reporting requirement in database applications is selecting the latest purchase, or latest job, or oldest chlld for each person in a table. Any beginning student of SQL knows how to return the most recent date in a table: SELECT MAX(rec_date) FROM sales; max ——————————- 2011-03-15 18:04:45.178057-04 (1 row) But that doesn’t tell us