Dear all,
As per topic that I've some problem in using sum function in my foxpro's query. The sum value suppose be assigned in one times but It is summed-up value in few times based on total number record in grids. The problems of sum function won't be exists in MSSQL query where it is always assigned in one times only. By the way, I'm using VFP6. Can anyone explain what is the problem?
Here is my query in coding
create table tmp1 (paidid c(15),gros_amt n(12,2))
insert into tmp1 values("PA2015001",12.56)
insert into tmp1 values("PA2015001",30.56)
create table tmp2 (paidid c(15),paid n(12,2))
insert into tmp2 values("PA2015001",100.00)
Different on first sections
select sum(t1.gros_amt) as gros_amt, ;
sum(t2.paid) as paid ; =>Assign sum function here.
from tmp1 t1 ;
left outer join tmp2 t2 ;
on alltrim(t1.paidid) == alltrim(t2.paidid) =>Result for Field "Paid" is "200.0".This is incorrect result.
=>If i using on MSSQL query, it will be return "100.0" as I want.
Different on second sections
select sum(t1.gros_amt) as gros_amt,;
t2.paid as paid ; =>Remove sum function here.
from tmp1 t1 ;
left outer join tmp2 t2 ;
on alltrim(t1.paidid) == alltrim(t2.paidid) =>Result for Field "Paid" is "100.0".This is correct result.
Thanks appopriate to someone could helps.
As per topic that I've some problem in using sum function in my foxpro's query. The sum value suppose be assigned in one times but It is summed-up value in few times based on total number record in grids. The problems of sum function won't be exists in MSSQL query where it is always assigned in one times only. By the way, I'm using VFP6. Can anyone explain what is the problem?
Here is my query in coding
create table tmp1 (paidid c(15),gros_amt n(12,2))
insert into tmp1 values("PA2015001",12.56)
insert into tmp1 values("PA2015001",30.56)
create table tmp2 (paidid c(15),paid n(12,2))
insert into tmp2 values("PA2015001",100.00)
Different on first sections
select sum(t1.gros_amt) as gros_amt, ;
sum(t2.paid) as paid ; =>Assign sum function here.
from tmp1 t1 ;
left outer join tmp2 t2 ;
on alltrim(t1.paidid) == alltrim(t2.paidid) =>Result for Field "Paid" is "200.0".This is incorrect result.
=>If i using on MSSQL query, it will be return "100.0" as I want.
Different on second sections
select sum(t1.gros_amt) as gros_amt,;
t2.paid as paid ; =>Remove sum function here.
from tmp1 t1 ;
left outer join tmp2 t2 ;
on alltrim(t1.paidid) == alltrim(t2.paidid) =>Result for Field "Paid" is "100.0".This is correct result.
Thanks appopriate to someone could helps.