Re: Converting from MS Access field aliases

Поиск
Список
Период
Сортировка
От chester c young
Тема Re: Converting from MS Access field aliases
Дата
Msg-id 746273.93291.qm@web54305.mail.re2.yahoo.com
обсуждение исходный текст
Ответ на Converting from MS Access field aliases  (Joel Richard <postgres@joelrichard.com>)
Ответы Re: Converting from MS Access field aliases  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: "Nicholas Barr"
Дата:
Сообщение: Re: Converting from MS Access field aliases
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Converting from MS Access field aliases