Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

need to get the relationships out via query

Posted on 2012-03-29
3
Medium Priority
?
266 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

721 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