A
annysjunkmail
I have a complicated query I need to run and am not sure how to
approach it...looking for some guidance.
I have 2 tables:
1) tblPayments (contains a list of payments made to an Applicant)
2) tblAuditCheck contains a list of Applicants with a variable 'cut-
off' audit date)
tblPlayments has fields: ApplicantID, DateOfPayment, AmtofPayment
tblAuditCheck has fields: ApplicantID, DateofAuditCheck
Example data from tblPlayments is as follows:
ApplicantID DateOfPayment AmtofPayment
1 17/07/2006 £10,000
1 29/07/2006 £2,500
1 19/09/2006 £1,000
2 15/09/2006 £1,200
2 19/09/2006 £2,200
2 30/09/2006 £3,100
3 03/10/2006 £4,100
3 05/10/2006 £5,800
3 04/11/2006 £7,00
I am trying, via a query, to sum the payments in tblPayments BUT
restricting it to the audit date contained in field DateofAuditCheck
in tblAuditCheck so, based on the above data, it should like the
following.
ApplicantID DateofAuditCheck TotalPaymentReceived
1 01/08/2006 £12,250
2 20/09/2006 £3,400
3 05/10/2006 £9,900
There are approx 10000 records to be analysed hence the need for a
speedy query.
I really hope this can be done.
Grateful for any advice
Chris
approach it...looking for some guidance.
I have 2 tables:
1) tblPayments (contains a list of payments made to an Applicant)
2) tblAuditCheck contains a list of Applicants with a variable 'cut-
off' audit date)
tblPlayments has fields: ApplicantID, DateOfPayment, AmtofPayment
tblAuditCheck has fields: ApplicantID, DateofAuditCheck
Example data from tblPlayments is as follows:
ApplicantID DateOfPayment AmtofPayment
1 17/07/2006 £10,000
1 29/07/2006 £2,500
1 19/09/2006 £1,000
2 15/09/2006 £1,200
2 19/09/2006 £2,200
2 30/09/2006 £3,100
3 03/10/2006 £4,100
3 05/10/2006 £5,800
3 04/11/2006 £7,00
I am trying, via a query, to sum the payments in tblPayments BUT
restricting it to the audit date contained in field DateofAuditCheck
in tblAuditCheck so, based on the above data, it should like the
following.
ApplicantID DateofAuditCheck TotalPaymentReceived
1 01/08/2006 £12,250
2 20/09/2006 £3,400
3 05/10/2006 £9,900
There are approx 10000 records to be analysed hence the need for a
speedy query.
I really hope this can be done.
Grateful for any advice
Chris