|
|
Archives of the TeradataForum
Message Posted: Fri, 22 Aug 2008 @ 10:29:21 GMT
Subj: | | Re: How Can I Avoid Repeating an Expression? |
|
From: | | Tienhoven, Menno van |
Hi Phil,
Teradata allows you to reuse a 'calculated' column from a sub-select. So what you could do is to alter the From part of your query
From
(select
(100 * (curr_bal - cl_amt) / cl_amt) as MyTempColumn,
..
Rest_of_the_columns_needed
..
From Table
) as MyTable
In your original query you can then use the MyTable.MyTempColumn in the CASE statement instead of having to restate the calculation every
time.
Kind regards,
Menno van Tienhoven
| |