I have a table in the following format:
What I want to do is return for every region the person with the highest Sales and if there is a tie, then just return the person that has the higher REP#. So the results of the example would be:
I first made a query to find the max sales per region that returns:
But I am not quire sure how to combine it with the original table that would return the person with the higher REP# in the case of multiple people having the same sales. I end up with results like this:
How do I get is so Mike is the only one returned for region A? Any help would be greatly appreciated.
Code:
REGION REP# NAME STATE SALES
A 0031 Joe MA $10,000
A 0302 Mary CA $15,000
A 0063 Mike TX $15,000
B 0004 Bob NY $7,000
...
Code:
REGION REP# NAME STATE SALES
A 0063 Mike TX $15,000
B 0004 Bob NY $7,000
...
Code:
REGION MaxOfSALES
A $15,000
B $7,000
...
Code:
REGION REP# NAME STATE SALES
A 0302 Mary CA $15,000
A 0063 Mike TX $15,000
B 0004 Bob NY $7,000
...
How do I get is so Mike is the only one returned for region A? Any help would be greatly appreciated.