Solved

need to get the relationships out via query

Posted on 2012-03-29
3
262 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
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 …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

786 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