I believe previous versions actually allowed you
to (if memory serves), but the developers currently
disabled this statement because it could sometimes
cause incorrect results.  At:

    http://www.postgresql.org/docs/todo.html

you'll find several references to this problem:

* -INSERT ... SELECT ... GROUP BY groups by target
  columns not source columns 

* redesign INSERT ... SELECT to have two levels of
  target list 

Hope that helps, 

Mike Mascari ([EMAIL PROTECTED])

--- sam smith <[EMAIL PROTECTED]> wrote:
> Hi All
> 
> I'm pretty new to postgres and I'm finding soemthing
> baffling.  I can 
> perform the following query without a problem -
> 
> select loser,count(*) from moves group by loser;
> 
> but when i combine it with an insert into -
> insert into losses select loser,count(*) from moves
> group by loser;
> 
> I get
> ERROR:  Illegal use of aggregates or non-group
> column in target list
> 
> Am I doing something wrong or is it not possible to
> combine insert into and 
> group by.
> 
> I'm using PostgreSQL 6.5.0
> 
> Cheers
> Sam
> 

_____________________________________________________________
Do You Yahoo!?
Free instant messaging and more at http://messenger.yahoo.com

Reply via email to