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

From: "Brett W(dot) McCoy" <bmccoy(at)lan2wan(dot)com>
To: sam smith <sam_smith20(at)hotmail(dot)com>
Cc: pgsql-general(at)hub(dot)org
Subject: Re: [GENERAL] "group, by", problem, when, combined, with, "insert, into"
Date: 1999-08-05 17:19:10
Message-ID: Pine.BSI.3.91.990805131300.14709D-100000@access1.lan2wan.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 4 Aug 1999, sam smith wrote:

> 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

I think you want 'select loser, count(*) into losses from moves group by
loser'

Brett W. McCoy
http://www.lan2wan.com/~bmccoy
-----------------------------------------------------------------------
Keep Cool, but Don't Freeze
- Hellman's Mayonnaise

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tim Stevens 1999-08-05 22:34:17 table does not exist
Previous Message Dustin Sallings 1999-08-05 16:43:22 Re: [GENERAL] Slow joins