Hacker News new | ask | show | jobs
by pjungwir 4501 days ago
This is mostly true, but in recent Postgres versions (since 9.1 I believe), if you GROUP BY the primary key, you can still include other columns in the SELECT statement. For instance:

    SELECT a.name, COUNT(b.id)
    FROM   a
    LEFT OUTER JOIN b ON b.a_id = a.id
    GROUP BY a.id
Pretty nice!