Solved

need to get the relationships out via query

Posted on 2012-03-29
3
265 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

624 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