"Robert B. Easter" <reaster@comptechnews.com> writes:
> The query I did was bad syntax I guess.
No, it's just a bug. PG accepts GROUP BY items that are references to
output columns, cf.
http://www.postgresql.org/devel-corner/docs/postgres/sql-select.htm
Looks like it gets confused when the grouped-by item contains a
subselect, however.
regards, tom lane