Hi there,
I have a table hits:
discovery=> \d hits
Table = hits
+----------------------------------+----------------------------------+-------+
| Field | Type | Length|
+----------------------------------+----------------------------------+-------+
| msg_id | int4 not null | 4 |
| count | int4 not null | 4 |
| first_access | datetime default now ( ) | 8 |
| last_access | datetime | 8 |
+----------------------------------+----------------------------------+-------+
Index: hits_pkey
and query:
discovery=> select count(*) from hits group by count;
ERROR: Aggregates not allowed in GROUP BY clause
There's easy workaround :
discovery=> select count(*) as qq from hits group by count;
but I'm curious is this a valid query ?
Last snapshot also behave like 6.5.3
Another question:
discovery=> select count(*) as qqq,* from hits group by last_access;
produces error:
ERROR: Illegal use of aggregates or non-group column in target list
Do I really need to have all fields in GROUP clause ?
Mysql seems allows this ?
Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83