Hi,

On 27/1/2012 4:16 PM, Josef Kokeš wrote:
> Hi!
>
> I find myself repeatedly writing code such as
>
> SELECT (a+b)*c AS value1,
>          some_function((a+b)*c) AS value2,
>          some_other_function((a+b)*c) AS value 3
> FROM ...
>
> Is there any other way to "reuse" a calculated value by referencing its
> alias than through views? E.g.
>
> CREATE VIEW valueview AS SELECT SELECT (a+b)*c AS value1 FROM ...
>
> SELECT value1, some_function(value1) AS value2 ...
>
> I know I can reference the column by its position in GROUP BY, but I
> need to reference it in the field list as well as in the WHERE condition.
>
> Thanks,
>
> Pepak
How about derived tables? - (supported from version 2.0 onwards)

http://www.firebirdsql.org/refdocs/langrefupd21-select.html#langrefupd21-derived-tables

Regards,

Jaison Joseph



------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu.  Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/firebird-support/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to