count(*) and group by's...

Поиск
Список
Период
Сортировка
От Howie
Тема count(*) and group by's...
Дата
Msg-id Pine.LNX.3.96.981020125545.10567E-100000@brap-eth0.toodarkpark.org
обсуждение исходный текст
Список pgsql-sql
I give up.  I'm trying to get a count of one table joining with another,
but Postgres ( 6.3.2 ) doesnt like me.

SELECT types.type,hosts.hostname,types.batch,count(codes.code) FROM
hosts,types,codes WHERE hosts.client=3 AND hosts.client=types.client AND
types.type=codes.type GROUP BY types.type ORDER BY types.batch;

returns:

ERROR:  parser: illegal use of aggregates or non-group column in target
list

in fact, trying to do any join across types and codes results in an
illegal use/non-group column.  types.type is primary,
codes.type+codes.code is primary.

---
Howie <caffeine@toodarkpark.org>   URL: http://www.toodarkpark.org
        "Oh my god, they killed init!  YOU BASTARDS!"


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Jackson, DeJuan"
Дата:
Сообщение: RE: [SQL] timespan question: using value from row in select
Следующее
От: Paul Friberg CEO - ISTI
Дата:
Сообщение: PostgreSQL COPY command