|
|
Archives of the TeradataForum
Message Posted: Fri, 22 Aug 2008 @ 10:28:00 GMT
Subj: | | Re: How Can I Avoid Repeating an Expression? |
|
From: | | Baker, Andy |
Name the expression
sel substr(date,1,7) Yr_Month,
Svc_Ownr_Cd,
Bucket,
case
when cl_amt = 0 and curr_bal > cl_amt then '(0) CL=0 & Bal>CL'
when curr_bal <= cl_amt then '(1) not OL'
else case
when ((100 * (curr_bal - cl_amt) / cl_amt) (named clpct))
<= 10 then '(2) <= 10%'
when clpct <= 15 then '(3) <= 15%'
when clpct <= 20 then '(4) <= 20%'
when clpct <= 25 then '(5) <= 25%'
else '(6) > 25%'
end
end as OL_Pct,
count(1) Number
from Table
where ...
group by 1,2,3,4
Regards
Andy Baker
| |