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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

How to use result column names in having cause


  • From: "Andrus" <eetasoft(at)online(dot)ee>
  • To: pgsql-general(at)postgresql(dot)org
  • Subject: How to use result column names in having cause
  • Date: Fri, 31 Mar 2006 15:03:25 +0300
  • Message-id: <e0j5qm$1fls$1(at)news(dot)hub(dot)org>

CREATE TEMP TABLE foo( bar integer );

SELECT 123 AS x
  FROM foo
  GROUP BY 1
  HAVING x> AVG(bar)

causes

ERROR:  column "x" does not exist

Why ? How to make this working ?

In real application I have long expression instead of 123 and do'nt want
 repeat this expression in HAVING clause.

In VFP this select works OK.

Andrus. 





Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group