Using an ALIAS in WHERE clause

From: "Ron St(dot)Pierre" <rstpierre(at)syscor(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Using an ALIAS in WHERE clause
Date: 2002-11-29 00:17:30
Message-ID: umyF9.69583$ea.1219029@news2.calgary.shaw.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm using a query with similar functionality to the following:

SELECT id,
sum(hours) AS totalhours
FROM mytable
WHERE totalhours > 50;

I get the following error:
Attribute 'totalhours' not found.

Am I not allowed to use an alias here? If not, how can I get my desired
output?

Thanks

Note: I'm using postgresql 7.2

--
Ron St.Pierre
Syscor R&D
tel: 250-361-1681
email: rstpierre(at)syscor(dot)com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tycho Fruru 2002-11-29 00:30:44 Re: Using an ALIAS in WHERE clause
Previous Message Justin Clift 2002-11-28 23:31:28 Re: [ANNOUNCE] PostgreSQL Global Development Group Announces Version 7.3