Re: [GENERAL] "group, by", problem, when, combined, with, "insert, into" - Mailing list pgsql-general

From Mike Mascari
Subject Re: [GENERAL] "group, by", problem, when, combined, with, "insert, into"
Date
Msg-id 19990805093523.3067.rocketmail@web106.yahoomail.com
Whole thread Raw
List pgsql-general
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 (mascarim@yahoo.com)

--- sam smith <sam_smith20@hotmail.com> 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


pgsql-general by date:

Previous
From: "Brett W. McCoy"
Date:
Subject: Re: [GENERAL] "group, by", problem, when, combined, with, "insert, into"
Next
From: "Ross J. Reedstrom"
Date:
Subject: Re: [GENERAL] "group, by", problem, when, combined, with, "insert, into"