Writing Sql Command Count Distinct In Postgresql