Postgres Sql Using Distinct On Multiple Columns