|
|
Archives of the TeradataForum
Message Posted: Wed, 13 Dec 2006 @ 10:11:24 GMT
Subj: | | Re: Assigning a default value to derived values in |
|
From: | | Kunnath, Sidharth |
How about using your original query like a derived table?......
Select
Coalesce(Year,3000),
Coalesce(Month,3000),
TTL_TRANS_CNT,
TTL_TRANS_AMT
from
(select
extract(year from post_date) "Year",
extract(month from post_date) "Month",
sum(case when detail_type = 41 then 1 else 0 end) as
"TTL_TRANS_CNT",
sum(case when detail_type = 60 then amount else 0 end) as
"TTL_TRANS_AMT"
from CLARITY_TDL_AGE
where extract(year from post_date) = 2004
and extract(month from post_date) in (10,11)
group by cube (1,2)) a
order by 1,2;
| |