I'm doing data analysis of some customer data in a bunch of VFP 5.0 free tables (no actual database container); they're used in an accounting package I won't mention (but's it's initials are SBT). I'm doing an inner join which should produce some very straight-forward results. Here's the query...
select temp.custno, SUM(temp.invamt), arycsh.custno, sum(arycsh.paidamt), sum(temp.invamt - arycsh.paidamt) as diff ;
from temp full outer join arycsh on temp.custno = arycsh.custno ;
where not temp.current = 'X';
and temp.custno = 'A' ;
group by temp.custno ;
into cursor reportA
...but when I look at my results for the aggregates, the numbers are astronomical. I remove the sum aggregates and grouping, run the query again, and find that each record in the temp table is being joined by every field in the arycsh table that has the matching custno field; a sort of one to many join. What the....?
select temp.custno, SUM(temp.invamt), arycsh.custno, sum(arycsh.paidamt), sum(temp.invamt - arycsh.paidamt) as diff ;
from temp full outer join arycsh on temp.custno = arycsh.custno ;
where not temp.current = 'X';
and temp.custno = 'A' ;
group by temp.custno ;
into cursor reportA
...but when I look at my results for the aggregates, the numbers are astronomical. I remove the sum aggregates and grouping, run the query again, and find that each record in the temp table is being joined by every field in the arycsh table that has the matching custno field; a sort of one to many join. What the....?