Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Total Due in Group Header of Statement Report
Message
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00095431
Message ID:
00095462
Views:
26
>Paul,
>
>I would doubt that you could actually calculate the totals IN the sql itself since you most likely have detail lines being generated (Actually you could write a single complex sql to do this but its not for beginners, if you pass the data structure and sql statement to this forum there are several SQL experts here who could write it). I would just issue two more sql's, one to calculate the totals and another to combine the data of the detail and the totals together.

To get your totals for example: data grouping by invoice_no, total on amount

SELECT invoice_no, amount, etc , sum(amount) as totals FROM your_dtail_table GROUP BY invoice_no INTO TABLE your_summary

Then combine the two.

SELECT * from your_dtail_table, your_summary WHERE invoice_no = your_summary.invoice_no INTO...

Mike



>
>
>I apologize if this is a stupid question. I am new to SQL. I am using a select SQL statement to fill a cursor with the records. Can this totals field be calculated from within the select statement? Or do I fill the cursor with the select statement and then go back through the cursor to calculate the totals?
>>Or maybe there is some other solution?
>>
>>Thanks in advance,
>>
>>Paul
>>>>I am trying to create an "A/R Statement" Report. In the group header I have the customers name etc and the detail band has the individual invoices and in the group footer I have a field with a variable to sume the invoice amounts. This all works fine. I was wondering if there is any way to get this total of invoices on the group header. I want the portion that the customer sends in with the payment to have the total on it as well.
>>>>
>>>>Thanks,
>>>>
>>>>Paul
>>>
>>>You can add a totals field to your table and pre-calculate the invoice sums prior to calling the report.
>>>
>>>Mike
Michael McLain
Previous
Reply
Map
View

Click here to load this message in the networking platform