In PostgreSQL 9.4, I have a table:
id p_id
PK integer
-----------------
1 1
2 1
.............
123122 2233
Is there a way to count all the different values p_id
in a table with just one query ( without using subqueries ). I can use any window function.
source
to share