Postgresql Distinct On Order By Two