|
|
Archives of the TeradataForum
Message Posted: Thu, 19 Dec 2002 @ 17:43:25 GMT
Subj: | | Re: Unnecessary spool step |
|
From: | | Kumaran Anantaraman |
Somebody asked for the SQL code.
Here it is. I have renamed cols for security reasons. I am using V1R4.1.
Thanks.
Select '0000000000000000000000',
col_1 ,
sum(col_3)
from table_xxx
where
col_1 between '2002-12-02' and '2002-12-04'
group by col_1
union ALL
select
col_4,
col_1 ,
sum(col_5)
from table_xxx
where
col_1 between '2002-12-02' and '2002-12-04'
group by col_4,
col_1
order by 1
desc having sum(col_3) > 0
;
| |