pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliveiros d'Azevedo Cristina <oliveiros.cristina@marktest.pt>
To: Marcel Ruff <mr@marcelruff.info>
To: pgsql-sql@postgresql.org
Subject: Re: How change col name during query to use it in where clause
Date: Fri, 4 May 2012 13:43:37 +0100
Message-ID: <340C84580192462E94F2EF130C1C078D@marktestcr.marktest.pt> (raw)
References: <4FA3AEA9.6010401@marcelruff.info>

I'm affraid
you can't.


AFAIK,
WHERE clause is processed before the SELECT output expressions

Best,
Oliveiros
----- Original Message ----- 
From: "Marcel Ruff" <mr@marcelruff.info>
To: <pgsql-sql@postgresql.org>
Sent: Friday, May 04, 2012 11:25 AM
Subject: [SQL] How change col name during query to use it in where clause


> 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
>
> -- 
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql 




view thread (4+ messages)  latest in thread

Message-ID: <340C84580192462E94F2EF130C1C078D@marktestcr.marktest.pt>
Permalink:  ../340C84580192462E94F2EF130C1C078D@marktestcr.marktest.pt/
Also on:    postgresql.org/message-id/340C84580192462E94F2EF130C1C078D@marktestcr.marktest.pt

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: oliveiros.cristina@marktest.pt, mr@marcelruff.info
  Subject: Re: How change col name during query to use it in where clause
  In-Reply-To: <340C84580192462E94F2EF130C1C078D@marktestcr.marktest.pt>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox