Postgresql: distinct by one field and order by another
I am following along the example of this excellent question and first answer: PostgreSQL - fetch the rows which have the Max value for a column in each GROUP BY group But I need to do something slightly different. I…