Postgresql Distinct On Count