Re: Problem with aliasing

From: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with aliasing
Date: 2003-02-21 13:46:16
Message-ID: 3E562DA8.2070502@mega-bucks.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greg Stark wrote:
>
> Try either of:
>
> SELECT max(req1, req2, req3) AS max FROM invoices WHERE max(req1, req2, req3) <= now()

Ok, that works. But why can't I alias the result of the max() function
and use the alias in the where clause? Something like:

SELECT max(r1,r2,r3) as max from invoices WHERE max <= now();

Why can't postgres see the alias when inside the WHERE clause?

Jc

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tony Grant 2003-02-21 13:56:54 Re: Backend often crashing
Previous Message Patrick Welche 2003-02-21 13:38:24 Re: jdbc in OO