>I have a simple sum statement on table a. This sum statement is within a scan/endscan of table b.
>
>When I run the sum statement on table a it sends table b immediately to eof().
>
>It seems to be acting as if I have a relation set from table a to table b, but I don't.
>
>Any ideas?
>
>Thanks,
>Paul
SUM works on the currently selected table. So if you've got your SUM command inside a SCAN, you'll actually be moving the SCAN's file pointer to the end.
SELECT b
SCAN
SUM a.test TO SumValue
ENDSCAN
You'll actually only move the pointer for b to the end after the first record.
SELECT b
SCAN
SELECT a
SUM a.test TO SumValue
ENDSCAN
If you add the SELECT a before you do the SUM, the SUM will not move b's pointer. The ENDSCAN will automatically reselect b to continue the SCAN.