I'm trying write a Postgres query to display a distinct number of people but count the actual (non-distinct) number of people.
So if I have
1 Ray [email protected]
2 Ray [email protected]
3 Kate [email protected]
I'd want to show:
Ray 2
Kate 1
==
SELECT name, email, COUNT(*)
FROM (SELECT DISTINCT name, email
FROM people
WHERE degree = 'Gradiate')
I get:
ERROR: subquery in FROM must have an alias
LINE 3: FROM (SELECT DISTINCT name, email
How to fix this?