I need to get the SumOfPaymentAmount as well as LastPaymentAmount and LastPaymentDate for an InvoiceID from an Invoice table. I can do this with an aggregate query, but it is oh so slow even for not so large a recordset. I can also do this by first creating a recordset with Payment data for the Invoice in descending Date order to pick up the Last PaymentDate and PaymentAmount. Then I run an Aggregate query on the resulting temp table to get the Sum. Since the Temp Table has a lot less records than the complete Invoice Recordset, this works much faster.
Somehow it seems a little bit kludgy to generate the intermediate recordset.
Does anyone have a slicker way of doing this? Bonus Points for the answer!
Thanks for your help.
Somehow it seems a little bit kludgy to generate the intermediate recordset.
Does anyone have a slicker way of doing this? Bonus Points for the answer!
Thanks for your help.