jaycee99
25th September 2009, 11:13
I'm trying to sum all the tfcmg101.amnt field by using this method, it give me correct result.
select tfcmg101.ptbp, sum(tfcmg101.amnt):atotal
from tfcmg101
where tfcmg101.ptbp =:tfcmg101.ptbp and tfcmg101.btno = :tfcmg101.btno
and tfcmg101.cnum = :tfcmg101.cnum
and tfcmg101.ccur = :tfcmg101.ccur
group by tfcmg101.ptbp
selectdo
endselect
But, now i have condition for tfcmg101.amnt which is as below.
if (tfcmg101.tadv = tfcmg.tadv.slsinv) and (tfcmg101.amnt > 0) then
tfcmg101.amnt = tfcmg101.amnt * (-1)
endif
If it meet this condition then it should take the value for tfcmg101.amnt multiple with -1, before do the sum for tfcmg101.amnt.
Why the result is still same even i already put a condition? Any idea for this?
select tfcmg101.ptbp, sum(tfcmg101.amnt):atotal
from tfcmg101
where tfcmg101.ptbp =:tfcmg101.ptbp and tfcmg101.btno = :tfcmg101.btno
and tfcmg101.cnum = :tfcmg101.cnum
and tfcmg101.ccur = :tfcmg101.ccur
group by tfcmg101.ptbp
selectdo
endselect
But, now i have condition for tfcmg101.amnt which is as below.
if (tfcmg101.tadv = tfcmg.tadv.slsinv) and (tfcmg101.amnt > 0) then
tfcmg101.amnt = tfcmg101.amnt * (-1)
endif
If it meet this condition then it should take the value for tfcmg101.amnt multiple with -1, before do the sum for tfcmg101.amnt.
Why the result is still same even i already put a condition? Any idea for this?