SQL Rank Query

I currently have this query and I want to add Ranking but I can't figure it out.

Select UnderwriterContact, Sum(LoanCount) AS LoanCount
WHERE Cast(StatusDate as Date) = Cast(GETDATE() as Date)
GROUP by UnderwriterContact
ORDER by LoanCount DESC

I want the results to look like the attached - with Rankings

Any help is greatly appreciated!
Scott WilliamsData AnalystAsked:
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.

dsackerContract ERP Admin/ConsultantCommented:
Can you add the "attached". Thanks.
Scott WilliamsData AnalystAuthor Commented:
dsackerContract ERP Admin/ConsultantCommented:
Try this:

SELECT  UnderwriterContact,
        SUM(LoanCount)  AS LoanCount,
                        AS Ranking
WHERE   CAST(StatusDate AS Date) = CAST(GETDATE() AS Date)
GROUP BY UnderwriterContact

Open in new window

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
Scott WilliamsData AnalystAuthor Commented:
Awesome dsacker!  I tried this code by was stuck on the PARTITION BY NULL - I tried to Partition by UnderwriterContact

Thanks so much for your help!
dsackerContract ERP Admin/ConsultantCommented:
You can actually leave the PARTITION BY NULL out of the DENSE_RANK, and it will still work.

Very welcome. Glad to help.
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
Query Syntax

From novice to tech pro — start learning today.