Archives of the TeradataForum
Message Posted: Wed, 17 Mar 2004 @ 10:11:56 GMT
Thats a fair point. You would need to manage the signs separately, and the product calculation would become:
zeroifnull(exp(sum(ln(abs(nullifzero(col)))))) as n_product
Note this also accomodates zeros in this form.
The sign of the product is positive if the number of negative terms in the product is even, else the product is negative, so a further column of:
sum( case when col<0 then 1 else 0 end ) as n_neg,
to count the number of negative elements in col and then the sign itself should be:
-1*(n_neg mod 2) as signum,
so, finally, the product would be
signum * n_product as product
I hope that generalises the result to a more useful state.
|Copyright 2016 - All Rights Reserved|
|Last Modified: 23 Jun 2019|