Skip to content
ohsudo, Home

Tags

#aggregates

must appear in the GROUP BY clause or be used in an aggregate function
Databases

PostgreSQL "column must appear in the GROUP BY clause or be used in an aggregate function"

Fix the GROUP BY error in PostgreSQL: understand why it happens, then aggregate the column, group by it or by the primary key, or pick one row per group with DISTINCT ON.

Beginner · 3 min read