Where did we leave this?
> Given
> create table t1 (name text, value float8);
>
> this works:
> SELECT name, value FROM t1 GROUP BY name, value
> HAVING value/AVG(value) > 0.75;
>
> but this doesn't:
> SELECT name AS tempname, value FROM t1 GROUP BY name, value
> HAVING value/AVG(value) > 0.75;
> ERROR: Illegal use of aggregates or non-group column in target list
>
> Curiously, it's fine if the HAVING clause is omitted ... since name is
> not mentioned in the HAVING clause, I don't see the connection ...
>
> 6.4.2 and current sources show the same behavior.
>
> regards, tom lane
>
>
-- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610)
853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill,
Pennsylvania19026