Re: alias question
От | Tom Lane |
---|---|
Тема | Re: alias question |
Дата | |
Msg-id | 3969.1008345711@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: alias question (Stephan Szabo <sszabo@megazone23.bigpanda.com>) |
Список | pgsql-general |
Stephan Szabo <sszabo@megazone23.bigpanda.com> writes: > Assuming it is a column, you should be able to do something like > select Bank1, calc, calc*100 as var2 from > (select bank1, (var1+var2) as calc from ... ) ali; This should work for saving typing, but be aware that it doesn't necessarily save any computation. The planner will likely try to collapse the two selects together, thus rewriting into the form select bank1, (var1+var2) as calc, (var1+var2)*100 as var2 from ... This shouldn't be an issue unless there is a hugely expensive function or sub-select involved in the expression. In that case you might want to use a temp table for the results of the lower select, and then do the upper select from the temp table, so that the planner can't fold them together. regards, tom lane
В списке pgsql-general по дате отправления: