Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting Records Based on Comparison of Info Summarized from Two Tables

Status
Not open for further replies.

Conns

Technical User
Jan 28, 2010
1
CA
I'm needing assistance with a way to only display records if a certain condition is met based on information contained in 2 tables and summarized. The 2 tables are linked by a field called acct_no. The 1st table has multiple entries for acct_no of overdue_amt based on year. The 2nd table has multiple entries for acct_no of the CVA_amt based on year and class.

Here's an example of what I'm talking about:

Table A
acct_no
year
overdue_amt
Etc.

Table B
acct_no
year
Class
CVA_amt
Etc.

I'm trying to display accts where the sum of the overdue_amt for all years is greater than 40% of the sum of the CVA_amt for a specific year.

For example

Table A
Acct_no 123456789
2010 overdue_amt: 100
2011 overdue_amt: 300
2012 overdue_amt: 500
Total overdue_amt: 900
Table B
Acct_no: 123456789
2014 CVA_amt (class1): 500
2014 CVA_amt (class2): 1000
Total 2014 CVA: 1500

Account 123456789 should be displayed in the report (sum overdue_amt(900) is greater than 40% of sum CVA_amt (600))as follows:

Acct_no............ Total Overdue_Amt .......... 2014 CVA_amt
123456789 ............... 900 .............................. 1500

Where the sum of overdue_amt is zero or less than 40% of sum CVA_amt, the record should not be displayed.

Any help would be appreciated.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top