Sql Distinct Order By Postgresql