Rank Query with Ties in MS Access

I have an Access ranking query that is grouping results for a particular account. That part seems to be working fine but I am getting ties when the Denial_Adj_Amount is the same.

Here's my query:

SELECT [835Denials].RRC, [835Denials].REGION, [835Denials].FACILITY, [835Denials].MBO, [835Denials].FACILITY_STATE, [835Denials].FACILITY_CODE, [835Denials].MASTER_ID, [835Denials].ACCT_NUMBER, [835Denials].PT_TYPE, [835Denials].SumOfADJ_AMOUNT AS Denial_Adj_Amount, [835Denials].REASON_CODE, [835Denials].REMARK_CODE,

(select count(*) from [835Denials] AS RANK where [835Denials].Master_ID=RANK.Master_ID AND [835Denials].SumOfADJ_AMOUNT<=RANK.SumOfADJ_AMOUNT
GROUP BY [835Denials].MASTER_ID,[835Denials].REASON_CODE, [835Denials].REMARK_CODE
FROM 835Denials;

What do I need to do so there won’t be any ties? And when there is a tie to then adjust the ranking by Reason_Code in ASC order & if need be, by Remark_Code. Please help!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
try, revising the count portion with this

(select count(*) from [835Denials] AS RANK where [835Denials].Master_ID=RANK.Master_ID AND [835Denials].SumOfADJ_AMOUNT<=RANK.SumOfADJ_AMOUNT And [835Denials].[Reason_code] < RANK.[Reason Code]
GROUP BY [835Denials].MASTER_ID,[835Denials].REASON_CODE, [835Denials].REMARK_CODE,  [835Denials].[Reason_code]
Order BY [835Denials].[Reason_code]
Rey Obrero (Capricorn1)Commented:
oops sorry, too many fields

try, revising the count portion with this

(select count(*) from [835Denials] AS RANK where [835Denials].Master_ID=RANK.Master_ID AND [835Denials].SumOfADJ_AMOUNT<=RANK.SumOfADJ_AMOUNT And [835Denials].[Reason_code] < RANK.[Reason Code]
GROUP BY [835Denials].MASTER_ID,[835Denials].REASON_CODE, [835Denials].REMARK_CODE,  
Order BY [835Denials].[Reason_code]

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KCREN12Author Commented:
That worked but what do I do when the Reason Code is the same so then it needs to look at Remark_Code.I tried this but the other ranking disappeared.

(select count(*) from [835Denials] AS RANK where [835Denials].Master_ID=RANK.Master_ID AND [835Denials].SumOfADJ_AMOUNT<=RANK.SumOfADJ_AMOUNT AND [835Denials].[Reason_code] <= RANK.[Reason_Code]
AND [835Denials].[Remark_code] <= RANK.[Remark_Code]
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.