RE: [HACKERS] select count(*) from hits group by count; - Mailing list pgsql-hackers

From Dmitry Samersoff
Subject RE: [HACKERS] select count(*) from hits group by count;
Date
Msg-id XFMail.20000129194004.dms@wplus.net
Whole thread Raw
In response to select count(*) from hits group by count;  (Oleg Bartunov <oleg@sai.msu.su>)
List pgsql-hackers
On 29-Jan-2000 Oleg Bartunov wrote:
> Hi there,
> 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
 AFAIK, MS SQL, Sybase and Informix have the same restrictions, because using all fields in query with aggregates and
grouping is meaningless. Order of fields in group by clause also significant. 
 

-- 
Dmitry Samersoff, dms@wplus.net, ICQ:3161705
http://devnull.wplus.net
* There will come soft rains ...


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] select count(*) from hits group by count;
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] END/ABORT