>I have a table, LineItems, which is related into Details:
>I scan through LineItems, and for each related child record, I
>total up a field called CallAct:
>
>
>SELECT LineItems
>SCAN
>
> nTotal = 0
>
> SELECT Details
> IF NOT EOF()
> DO WHILE NOT EOF()
> nTotal = nTotal + Details.CallAct
> ENDDO
> ENDIF
>
> REPLACE IN LineItems CallTot WITH nTotal NEXT 1
>
>ENDSCAN
>>
>Anyone know how I can do this using SQL?
You can probably do it with something like
SELECT ;
Details.LineItemsForeignKey, ;
SUM(Details.CallTot) AS CallTot ;
FROM Details ;
INTO CURSOR Output ;
GROUP BY Details.LineItemsForeignKey
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up