Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] Illegal use of aggregates or non-group column in target list

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: "G(dot) Anthony Reina" <reina(at)nsi(dot)edu>
Cc: Jason <neumeier(at)bright(dot)net>, "pgsql-general(at)hub(dot)org" <pgsql-general(at)hub(dot)org>
Subject: Re: [GENERAL] Illegal use of aggregates or non-group column in target list
Date: 2000-03-04 17:05:29
Message-ID: Pine.LNX.4.21.0003040353170.489-100000@localhost.localdomain (view raw or flat)
Thread:
Lists: pgsql-general
G. Anthony Reina writes:

> It's interesting that "select target, avg(reaction_time) from data_table
> GROUP BY target;" works but not "select target, avg(reaction_time) from
> data_table;".
> 
> Doesn't the parser automatically group by the first variable returned?

The parser really doesn't know much about all of this. While you might
have a point that

	select field1, aggregate(field2) from table

doesn't have any other useful interpretation than an implied group by
field1, it's probably too much work to support such a non-SQL construct.

-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e(at)gmx(dot)net                   75262 Uppsala
http://yi.org/peter-e/            Sweden


In response to

pgsql-general by date

Next:From: Peter EisentrautDate: 2000-03-04 17:05:49
Subject: Re: [GENERAL] Nested tables
Previous:From: Peter EisentrautDate: 2000-03-04 17:05:17
Subject: Re: [GENERAL] Median, Quartile and Percentile Aggregate Functions

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group