Solved

need to get the relationships out via query

Posted on 2012-03-29
3
263 Views
Last Modified: 2012-04-02
I have a table named AGCOMCREV (25,129 records).  It contains agent commission contract records with things like agent hierarchy (if there are other agents making an "override" commission on a product's sale, contract effective date, and specific commission percentages for each product sold and to whom it will be paid.

My problem is this: for every AgentCode in the table, I need to get their commissions grouped by ContractEffectiveDate.  The goal is to reconstruct the contracts and any hierarchies for a big conversion project underway.  The info was in a flat text file and I've cleaned it up in Excel before loading the info into Access.

I also need to be able to pinpoint every hierarchy in the table.  For example, I need to show that AgentCode "A31F" worked underneath "A30N" for the contract effective November 15, 1997 and each agent earned "X" percent for each product type sold.  Agt1 is always equal to AgentCode so you know they are the selling agent.  "A30N" will have their own entry that should NOT show "A31F" because they are atop the hierarchy.  There are other cases where 3 or more agents are involved in the same hierarchy.

Please tell me if this needs to be split up into smaller tasks because I don't want to overly complicate this if it doesn't need to be so.  Thanks!
Database22-for-EE.accdb
0
Comment
Question by:kbdaemon
  • 3
3 Comments
 

Author Comment

by:kbdaemon
ID: 37786967
I forgot to mention that there should be lots of equivalent contracts - the percentages paid will be the same for all products.  In the end the problem should reduce down to maybe 20-30 different contracts, with many agents on the same contract type.
0
 

Accepted Solution

by:
kbdaemon earned 0 total points
ID: 37787857
OK, I've been working alot on this and have made it to:

SELECT AGCOMCREV.AgentCode, AGCOMCREV.[1stYrCommAgt1]*100 AS Expr1, AGCOMCREV.ContractEffectiveDate
FROM AGCOMCREV
WHERE (((AGCOMCREV.PolicyType)="0") AND ((AGCOMCREV.PolicyAgeLimit)=70));

That gets me 154 records.  I used PolicyType="0" because that is always the largest paying product on the commission contracts and represents a contract "type" (100 for 100%, or 90 for 90%).
How do I include the relationships if there are agents receiving an override commission?  I would want to indicate what they earn on PolicyType="0", and I am assuming the contract effective dates are equal (?).
0
 

Author Closing Comment

by:kbdaemon
ID: 37797252
closing question to ask in a different way since I got no responses.
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question