Re: Converting from MS Access field aliases - Mailing list pgsql-sql

From chester c young
Subject Re: Converting from MS Access field aliases
Date
Msg-id 746273.93291.qm@web54305.mail.re2.yahoo.com
Whole thread Raw
In response to Converting from MS Access field aliases  (Joel Richard <postgres@joelrichard.com>)
Responses Re: Converting from MS Access field aliases  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
>    SELECT field1 / 2 AS foo,
>           field2 * 2 AS bar,
>           foo + bar AS total
>    WHERE foo < 12;
> 
> The first two fields are fine, it's the third that's a problem. The  
> database reports
> 
>    ERROR:  column "foo" does not exist
> 

First, I think it would be great if this worked - like the alias to an
update table added in 8.2  - saves a lot of typing and makes queries
much more readable.

Second, only way I see is to set this on top of a view generating your
foo and bar aliases, and go from there.  Compared to rewriting the
expression each time, it has the advantages of better syntax in the end
and might yield better performance as well.



      
____________________________________________________________________________________
Got a little couch potato? 
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz 


pgsql-sql by date:

Previous
From: "Nicholas Barr"
Date:
Subject: Re: Converting from MS Access field aliases
Next
From: Tom Lane
Date:
Subject: Re: Converting from MS Access field aliases