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 ray@gmail.com
2 Ray ray@gmail.com
3 Kate kate@gmail.com
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?