Postgres Max Between Two Values Sql