How change col name during query to use it in where clause

From: Marcel Ruff <mr(at)marcelruff(dot)info>
To: pgsql-sql(at)postgresql(dot)org
Subject: How change col name during query to use it in where clause
Date: 2012-05-04 10:25:45
Message-ID: 4FA3AEA9.6010401@marcelruff.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

is an alias name not usable in the where clause?

select EXTRACT(day from enddate::TIMESTAMP - old_enddate::TIMESTAMP) AS TAGE from account_h where
TAGE>5;
ERROR: column "tage" does not exist
LINE 1: ... TAGE>5 ...

Thank you
Marcel

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas Kretschmer 2012-05-04 12:40:40 Re: How change col name during query to use it in where clause
Previous Message Christophe Pettus 2012-05-03 03:27:28 Re: [sfpug] pg_dump: aborting because of server version mismatch