Postgresql Count Distinct With Condition