|
|
Archives of the TeradataForum
Message Posted: Tue, 06 Mar 2007 @ 09:16:11 GMT
Subj: | | Re: Performance of a self join |
|
From: | | Goutham P |
Thanks all for your reply.
Given below is my query:
select A.*
,Value2 / sum(Value2) over (partition by A.dim1, A.dim2, A.dim3,
A.dim4) as value3
from A,
(
select dim1
,dim2
,dim3
,dim4
,dim5
,metric 1/count(metric 2) as value2
from A
group by 1,2,3,4,5
) B
where A.dim1 = B.dim1
and A.dim2 = B.dim2
and A.dim3 = B.dim3
and A.dim4 = B.dim4
and A.dim5 = B.dim5
and A.dim6 = B.dim6
The PI of the table is only dim 1, dim2
| |