>Hi Donald,
>
>When I try this I do get a total, but it skips some of the customers. Here is the SQL:
>
>select pay_schdate as cur_schdate, ;
> pay_amt as cur_amt, ;
> sum(pay_amt) as cur_tot, ;
> cus_name as cur_name, ;
> cus_addr1 as cur_addr1, ;
> cus_addr2 as cur_addr2, ;
> cus_city as cur_city, ;
> cus_st as cur_st, ;
> cus_zip as cur_zip, ;
> stu_student as cur_student, ;
> stu_acct as cur_acct, ;
> stu_sub as cur_sub ;
> from customer, student, payment ;
> where pay_amt > 0 and ;
> pay_acct = cus_acct and ;
> (pay_acct = stu_acct and pay_sub = stu_sub) and ;
> empty(pay_paydate) ;
> into cursor lscur
>
>>>
>>>Paul:
>>>
>>>Try select
, sum(invoice) as inv_total ....
>>
>>That should be:
>>
>>select YourFieldList, sum(invoice) as inv_total ...
You could have a problem with this query if there are no payments for a customer/student. (Outer Join)
Wayne
Wayne Myers, MCSD
Senior Consultant
Forte' Incorporated
"The only things you can take to heaven are those which you give away" Author Unknown