☆
1
ERROR column must appear in GROUP BY or aggregate function
Postgres 15. Query: SELECT user_id, email, COUNT(*) FROM logs GROUP BY user_id; throws ERROR: column "logs.email" must appear in the GROUP BY clause or be used in an aggregate function. I don't want to group by email since multiple rows share a user_id. What's the right way to get the email along with the count? Thought about DISTINCT ON but not sure.
1 replies