Using an ALIAS in WHERE clause - Mailing list pgsql-general

From Ron St.Pierre
Subject Using an ALIAS in WHERE clause
Date
Msg-id umyF9.69583$ea.1219029@news2.calgary.shaw.ca
Whole thread Raw
Responses Re: Using an ALIAS in WHERE clause  (Tycho Fruru <tycho@fruru.com>)
Re: Using an ALIAS in WHERE clause  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@syscor.com



pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Select nextval problem
Next
From: Tycho Fruru
Date:
Subject: Re: Using an ALIAS in WHERE clause