Re: [GENERAL] "group, by", problem, when, combined, with, "insert, into"

From: Mike Mascari <mascarim(at)yahoo(dot)com>
To: sam smith <sam_smith20(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] "group, by", problem, when, combined, with, "insert, into"
Date: 1999-08-05 09:35:23
Message-ID: 19990805093523.3067.rocketmail@web106.yahoomail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)yahoo(dot)com)

--- sam smith <sam_smith20(at)hotmail(dot)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

Browse pgsql-general by date

  From Date Subject
Next Message Ross J. Reedstrom 1999-08-05 14:01:37 Re: [GENERAL] "group, by", problem, when, combined, with, "insert, into"
Previous Message DE VOLDER Fabrice 1999-08-05 06:25:29 unsuscribe