Postgres Count Distinct In Pivot